Skip to content

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

@nanto

Description

@nanto

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions