Description
🐛 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",