Skip to content

fix(@react-aria/select): avoid empty option in hidden select markup#9677

Merged
devongovett merged 2 commits intoadobe:mainfrom
sonsu-lee:fix/8085-hidden-select-empty-option
Mar 16, 2026
Merged

fix(@react-aria/select): avoid empty option in hidden select markup#9677
devongovett merged 2 commits intoadobe:mainfrom
sonsu-lee:fix/8085-hidden-select-empty-option

Conversation

@sonsu-lee
Copy link
Contributor

@sonsu-lee sonsu-lee commented Feb 18, 2026

Closes #8085

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  1. Run yarn jest packages/@react-aria/select — two new tests should pass:
  • should include a non-empty placeholder option for native select markup
  • should submit an empty string when no value is selected
  1. In a Select story with no default value, inspect the hidden <select> and verify the first <option> is <option value="" label="\u00A0"> (no longer empty)

🧢 Your Project:

  • Personal

{label}
<select {...selectProps} ref={selectRef}>
<option />
<option value="" label={'\u00A0'}>{'\u00A0'}</option>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably unnecessary to have both label and children?

@devongovett devongovett added this pull request to the merge queue Mar 16, 2026
Merged via the queue into adobe:main with commit 8b3016c Mar 16, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select markup includes an empty option element, which fails W3C validation

3 participants