adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.53k stars 1.08k forks source link

RAC NumberField validation broken in next.js #6684

Open mwannewitz opened 1 month ago

mwannewitz commented 1 month ago

Provide a general summary of the issue here

Next.js uses the react canary, which apparently breaks the validation of the RAC NumberField. Other form components seem not to have this issue.

๐Ÿค” Expected Behavior?

The latest error message returned from the validate function is shown.

๐Ÿ˜ฏ Current Behavior

An outdated error message is shown when unfocusing the NumberField, although validate is called with the correct value.

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

Reproduced in https://codesandbox.io/p/sandbox/amazing-booth-57zg7g with react 18.3.0-canary-14898b6a9-20240318

Type in an even number and you'll get the error for odd numbers.

Version

react-aria-components@1.2.1

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge

If other, please specify.

No response

What operating system are you using?

macOS Sonoma 14.5

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

snowystinger commented 1 month ago

~I'm not sure what's happening there, but wouldn't this likely be a React bug? What changed in React and not in a major version?~

snowystinger commented 1 month ago

~Also, it looks like it's working with 18.3.1?~

Edit, my coworker reminded me that canary was React 19 until a few months ago. I checked on the latest 19 pre-release and it's broken there :( We'll have to take a look.