Skip to content

Input type=number data validation #2502

Answered by TheSisb
dsnair asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dsnair,

Unfortunately, <input type="number" /> doesn't prevent typing letters. In Firefox you can type any letter, and in Chrome you can still type e. You can try it here: https://codesandbox.io/s/input-type-number-oqsybb?file=/src/App.js.

From Paste's side of things, we setup <Input type="number" to correctly display the right settings for screen readers and mobile keyboards. Any input validation must be done by whoever implements our component, as it's hard to know how to validate generically. For example, currencies may be separated by ,, ., , or have no separation at the thousand mark. There are many little nuances to input validation. As such, it is impossible for us to do it be…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gloriliale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants