Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.78k stars 723 forks source link

Pressing decimal clears input field #753

Closed twantonie closed 5 years ago

twantonie commented 5 years ago

Hi,

When using a number input with usePreview: false, pressing the decimal key clears the input. This issue can be observed in the following fiddle.

Mottie commented 5 years ago

Hi @twantonie!

TLDR; Use a "text" type input, and it'll work as expected (demo).

The problem is that the "number" type of input doesn't work with this library.

The first issue is that the caret position can only be read for inputs of type text, search, URL, tel and password (ref). This breaks the ability to click in the middle of a value and enter a value using the virtual keyboard.

The second issue is probably an internal one, but I don't plan on fixing it since the "number" type input doesn't work as expected anyway. When you type in 8. the input clears, and you'll see this message in the console log:

The specified value "8." is not a valid number. The value must match to the following regular expression: -?(\d+|\d+.\d+|.\d+)([eE][-+]?\d+)?

twantonie commented 5 years ago

Thank you for your quick response

Mottie commented 5 years ago

Updated the FAQ