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

NumberInput content is replaced with -9007199254740991 on blur when content is '-' #8356

Open
1 of 3 tasks
jlfwong opened this issue Mar 13, 2024 · 1 comment
Open
1 of 3 tasks

Comments

@jlfwong
Copy link

jlfwong commented Mar 13, 2024

Description

When I create a <NumberInput> component, input a single '-' and blur the field, the content becomes -9007199254740991. I'd expect it to either stay as '-', change into a 0, or revert to the previous valid numeric input.

Link to Reproduction

https://codesandbox.io/p/sandbox/goofy-currying-f8sw7q

Steps to reproduce

  1. Open code sandbox
  2. Focus number input
  3. Enter a single '-' into the number input
  4. Blur the field

Chakra UI Version

2.8.2

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@jlfwong
Copy link
Author

jlfwong commented Mar 13, 2024

Hm, I guess this is technically not a bug, but this seems like extremely unexpected behavior to have by default. It seems like this is clamping on blur to the default min/max values:

From the docs:

These props defaults to Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER . If they do not match your requirements you can use other Number properties as min or max.

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

No branches or pull requests

1 participant