Skip to content

input[type='number'] event.target.value changes to empty string when . or , pressed and onChange not emitted when . and , used #13752

@kisickilukasz

Description

@kisickilukasz

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

What is the current behavior?
onChange event changes value of an input to an empty string when . or , is pressed. Additionally it seems like it doesn't fire onChange after the dot and comma (example 1.234,000) at all
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
https://codesandbox.io/s/7ox8qx2mn1
What is the expected behavior?
value stays as an Integer or as seen by the user 1. should be 1. and not "". Should fire onChange.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16 +, Chrome, No

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