Skip to content

@react-stately/numberfield Controlled Value Bug #3480

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

Closed
callen1994 opened this issue Sep 4, 2022 · 3 comments
Closed

@react-stately/numberfield Controlled Value Bug #3480

callen1994 opened this issue Sep 4, 2022 · 3 comments

Comments

@callen1994
Copy link

🐛 Bug Report

When using a controlled value on a component that uses a "useNumberFieldState" hook, the component will hold a state value that is out of sync with the parent. On blur the emitted value will be different from the stored value. Also the value will toggle between two previous values when you focus and un-focus the element.

🤔 Expected Behavior

The State within the component should reflect what's displayed on the input element. The value shouldn't revert back to a previous value when on-blur.

😯 Current Behavior

This code sandbox displays the bug effectively.
https://codesandbox.io/s/8iddiw

💁 Possible Solution

When I installed @react-stately/numberfield @3.0.0 the bug stopped showing up

🔦 Context

I'm trying to use React ARIA to build a library of styled input components.

💻 Code Sample

This code sandbox displays the bug effectively.
https://codesandbox.io/s/8iddiw

@LFDanLu
Copy link
Member

LFDanLu commented Sep 6, 2022

I think this is a strict mode issue, seems to work as expected after removing that from your sandbox. Closing in favor of the umbrella issue: #779

@LFDanLu LFDanLu closed this as completed Sep 6, 2022
@Kunz-David
Copy link

This bugged me for a long time till I found this post. It still doesn't work the way it should in strict mode.

@snowystinger
Copy link
Member

Have you tried it on this branch? #4564

Any extra eyes on it are very helpful before it gets merged. Thank you!

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

4 participants