Skip to content

Issue with input[type=number] rendering decimal points #11606

Closed
@vamsiampolu

Description

@vamsiampolu

Do you want to request a feature or report a bug?

I would like to report a bug.

What is the current behavior?

When I use the <input type=number />, there is an issue with it displaying one additional decimal point. I noticed that the initial value in state is 1.2, when I type in a . at the end of the input 1.2. is displayed while the value in state still remains 1.2. When I type in another . at the end, the value disappears and returns an empty string instead.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template for React 16: https://jsfiddle.net/Luktwrdm/, template for React 15: https://jsfiddle.net/hmbg7e9w/).

Demo: https://www.webpackbin.com/bins/-KzQwHM22gvWWpedlwg0

What is the expected behavior?

The expected behaviour is either that the input performs no built in validation or that the validation is restrictive enough to disallow the second dot, or if the validation cannot be modified, one must ensure that the second dot changes the value back to the value without the second dot.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

This has affected me in React versions: 15.3 and 15.4, I have not tried this in React 16. I have only tried this in Google Chrome v61 and have not tried this in any of the other browsers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions