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

[RAC] NumberField removes decimal places when increment/decrement buttons are pressed #7288

Open
ozguruysal opened this issue Oct 29, 2024 · 0 comments

Comments

@ozguruysal
Copy link

ozguruysal commented Oct 29, 2024

Provide a general summary of the issue here

We are moving to RAC NumberField component but having issues with how it behaves with float numbers. Native number input keeps decimal places when increment/decrement buttons are pressed while RAC NumberField removes them.

🤔 Expected Behavior?

Incrementing and decrementing should respect the step value. For instance, if the current value is 1.5 and step is set to 1, clicking + button should increase the value by 1, resulting in 2.5 rather than 2.

Edit: Setting step to 1 explicitly in NumberField will actually round the default value.

😯 Current Behavior

The RAC NumberField component removes decimal places from float numbers when the increment or decrement buttons are pressed, resulting in rounded whole numbers.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

Go to https://stackblitz.com/edit/vitejs-vite-8sg8un?file=src%2FApp.tsx

  1. Press the increment button on the RAC Number field and the value changes to 2 and decimal places are removed
  2. Press the increment button of native number input and value increases by 1 and decimal places are preserved.

Version

React Aria Components v 1.4.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mac OS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

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