Form fields are reset even if reset event is cancelled #7602
Description
Provide a general summary of the issue here
Native form fields (<input>
) don't get reset if a reset
event's default action is cancelled by calling event.preventDefault()
. However, React Aria components get reset regardless of whether a reset
event's default action is cancelled or not.
🤔 Expected Behavior?
React Aria components don't get reset if preventDefault
method has been called for a reset
event.
😯 Current Behavior
React Aria components get reset even if preventDefault
method has been called for a reset
event.
💁 Possible Solution
No response
🔦 Context
To avoid React 19's automatic form reset behavior (facebook/react#28804), the Conform validation library accepts a temporary solution by cancelling a reset
event (edmundhung/conform#681 (comment)). It is helpful if that solution also applies to React Aria components.
🖥️ Steps to Reproduce
- Visit https://codesandbox.io/p/sandbox/dkqzk2.
- Input some values to the RAC field and the native field.
- Click the "Reset" button.
- Expected: both fields' values remain.
- Actual: only the native field's value remains.
Version
react-aria-components 1.5.0
What browsers are you seeing the problem on?
Firefox, Chrome
If other, please specify.
No response
What operating system are you using?
Windows 11
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response