Skip to content

Restore controlled form state after reset#36388

Open
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/form-reset-controlled-select
Open

Restore controlled form state after reset#36388
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/form-reset-controlled-select

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

Fixes #30580.

Automatic form resets call the browser's native form.reset(), which can reset a controlled <select> to the first option before React has a chance to restore the controlled value. Restore React-managed form controls after the native reset so controlled selects keep their value, matching the behavior users expect from controlled inputs.

How did you test this change?

  • corepack yarn test ReactDOMForm-test --runInBand --testNamePattern="restore a controlled select" (fails before the implementation change, passes after)
  • corepack yarn test ReactDOMForm-test
  • corepack yarn test --prod ReactDOMForm-test
  • corepack yarn prettier
  • corepack yarn linc
  • ./node_modules/.bin/flow.cmd status with the generated dom-browser Flow config

@meta-cla meta-cla Bot added the CLA Signed label May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[React 19] Controlled <select> component is subject to automatic form reset

1 participant