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

Issue with input type="number" on Firefox/Safari #5866

Open
juliendelort opened this issue Feb 21, 2024 · 2 comments
Open

Issue with input type="number" on Firefox/Safari #5866

juliendelort opened this issue Feb 21, 2024 · 2 comments
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@juliendelort
Copy link

I am trying to replace the Input component in order to use a <input type="number" />. This works well in chrome, but I'm hitting an issue on Firefox and Safari: when typing a non-number character, the input gets cleared out and it's impossible to type anything else nor to clear the input (have to refresh the page in order to get unstuck).

Here is a minimal reproduction (has to be opened in Firefox or Safari):

https://codesandbox.io/p/sandbox/youthful-lamport-c39lv6

And here is a gif of the issue (using Firefox):

react-select-number-bug

In the gif above, I first type "123" then the letter "a" which triggers the input to be cleared. From that point forward, everything I type (letters, numbers, backspace) has no effect.

@juliendelort juliendelort added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Feb 21, 2024
@hybs123
Copy link

hybs123 commented Mar 6, 2024

I am encountering the same issue. In Chrome it clears the invalid input but in Mozilla it does not clear the invalid input that is a non-number character in the number type input field.
On input we will have to implement a logic that clears out the input field when it encounters an invalid input.

@hybs123
Copy link

hybs123 commented Mar 6, 2024

https://codesandbox.io/p/sandbox/react-select-number-input-issue-forked-rqxhvc?file=%2Fexample.tsx%3A12%2C48

Here I have implemented the validation algorithm that checks the input value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

2 participants