Repository navigation
fix: apply defaults to untouched selects with disabled optgroups - #13953
Merged
bluebill1049 merged 2 commits intoOct 28, 2026
Merged
bluebill1049 merged 2 commits into
bluebill1049 merged 2 commits into
Conversation
charan-rathore
marked this pull request as ready for review
October 28, 2026 04:22
bluebill1049
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
An untouched single select with its first option inside a disabled optgroup is mistaken for a pre-hydration edit. The browser skips that option, but its own
disabledproperty remains false. RHF then retains the browser-selected value instead of applyingdefaultValuesand marks the field dirty. For example, a disabled group containing A followed by B/C retains B despitedefaultValues: { choice: 'c' }.Exclude options whose parent is a disabled optgroup when finding the browser's initial enabled option. Real user edits remain preserved. This is a follow-up to #13872, found while reviewing that path; no issue was filed. It does not change reset's disabled-field registry or add a public API/dependency.
Type of change
Checklist
Validation on Node 22.23.2 and pnpm 11.21.0, based on master a8e1103:
AI-assisted implementation and verification with Codex; Jev supplied bounded engineering decisions.