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

React.StrictMode: Event handlers for number field work inconsistent for keys and buttons. #3974

Closed
hastebrot opened this issue Jan 28, 2023 · 4 comments

Comments

@hastebrot
Copy link

hastebrot commented Jan 28, 2023

🐛 Bug Report

Components with useNumberField() and useNumberFieldState() are not compatible with React.StrictMode.

I searched for number field and strict mode in the github issues.

🤔 Expected Behavior

I click on the increment or decrement button and it changes the number on click. I use the keyboard cursor keys up or down and it changes the number.

😯 Current Behavior

Single clicking a button does nothing. Long clicking a button sometimes changes the numbers. I have to use keyboard cursor key up and down, afterwards I can e.g. increase a number by using key up twice, i.e. it will increase the number after the second key press.

💁 Possible Solution

Seems the event handlers for the buttons and keys are wrong.

🔦 Context

I want to use a number input with react strict in development mode.

💻 Code Sample

https://codesandbox.io/p/sandbox/quirky-star-z0odrx?file=%2Fsrc%2FApp.tsx

🌍 Your Environment

Software Version(s)
react-spectrum latest or nightly
Browser Chrome 109, Firefox 110
Operating System macOS 13.1 (Ventura)

Does not work with

    "react-aria": "3.22.1-nightly.3669",
    "react-stately": "3.20.1-nightly.3669",

Also does not work with

    "react-aria": "3.22.0",
    "react-stately": "3.20.0",

🧢 Your Company/Team

🕷 Tracking Issue (optional)

@devongovett
Copy link
Member

StrictMode is a work in progress. The umbrella issue is #779.

@cedeber
Copy link
Contributor

cedeber commented Sep 11, 2023

This is still broken even though #779 is closed: https://codesandbox.io/p/sandbox/trusting-sea-4yr3cy

@snowystinger
Copy link
Member

Thanks for letting us know. I've verified something is happening in that codesandbox, I don't know what yet, but I'll reopen so we can look into it further.

@snowystinger snowystinger reopened this Sep 11, 2023
@snowystinger
Copy link
Member

I can't reproduce anymore. If it's still an issue, we can reopen again with new test instructions

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