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

Form fields are reset even if reset event is cancelled #7602

Open
nanto opened this issue Jan 12, 2025 · 0 comments · May be fixed by #7603
Open

Form fields are reset even if reset event is cancelled #7602

nanto opened this issue Jan 12, 2025 · 0 comments · May be fixed by #7603

Comments

@nanto
Copy link

nanto commented Jan 12, 2025

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

  1. Visit https://codesandbox.io/p/sandbox/dkqzk2.
  2. Input some values to the RAC field and the native field.
  3. 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

@nanto nanto linked a pull request Jan 12, 2025 that will close this issue
5 tasks
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

Successfully merging a pull request may close this issue.

1 participant