HeliosInteractive / JS-OnScreen-Keyboard

Simple onscreen keyboard for web apps
15 stars 2 forks source link

Input type number clears the field with the symbols "." and "," #4

Open halyson97 opened 6 years ago

halyson97 commented 6 years ago

when adding the symbols "." and "," in an input field of type number, the library retries the message and clears the field

captura de tela de 2017-12-06 16-52-22 captura de tela de 2017-12-06 16-51-20

lcb931023 commented 6 years ago

Thanks for reporting! It's fine for input to reject , and in some situations ., but clearing the field isn't desired. Will look into this bug.

lcb931023 commented 6 years ago

Upon investigation, it seems that there's no way to disable or override <input type="number">'s validation

<input type="number"> elements do not support use of the pattern attribute for making entered values conform to a specific regex pattern. The rationale for this is that number inputs can't contain anything except numbers, and you can constrain the minimum and maximum number of valid digits using the min and max attributes, as explained above.

One potential workaround is to turn <input type="number"> into <input type="text">, and supply our own pattern regex.