Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing decimal clears input field #753

Closed
twantonie opened this issue Jul 31, 2019 · 3 comments
Closed

Pressing decimal clears input field #753

twantonie opened this issue Jul 31, 2019 · 3 comments

Comments

@twantonie
Copy link

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
Copy link
Owner

Mottie commented Jul 31, 2019

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
Copy link
Author

Thank you for your quick response

@Mottie
Copy link
Owner

Mottie commented Aug 7, 2019

Updated the FAQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants