Skip to content

fix(ComboBox): don't commit value on blur when isReadOnly - #10850

Closed
florianaltendorfer wants to merge 1 commit into
adobe:mainfrom
florianaltendorfer:bounty-10846
Closed

florianaltendorfer wants to merge 1 commit into
adobe:mainfrom
florianaltendorfer:bounty-10846

Conversation

@florianaltendorfer

@florianaltendorfer florianaltendorfer commented Oct 24, 2026 •

Copy link
Copy Markdown

Closes #10846.

A read-only ComboBox can't change its selection or input, but useComboBoxState still ran commitValue() on blur. When both value and inputValue are controlled and the selected item isn't in the collection (e.g. async items not loaded yet), commitSelection sees the input text differ from the missing item's text and fires onChange/onSelectionChange, which apps that derive the input text from the selection turn into a cleared field. The blur commit is now skipped when isReadOnly is set, the same way the focus handler already skips opening the menu. Keyboard commits were already disabled for read-only, so blur was the only remaining path.

✅ 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
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at AGENTS.md.

📝 Test Instructions:

Added a RAC test with a read-only ComboBox whose controlled value isn't in the items; focus and blur no longer call onChange/onSelectionChange (the test fails without the fix). Ran the jest ComboBox suites for RAC, react-aria, react-stately, React Spectrum v3 and S2. To check manually, use the repro from the issue: focus then blur the read-only field and the input keeps its text.

🧢 Your Project:

Read-only ComboBoxes cannot change their selection or input, so skip committing a value when focus leaves the field.

AI-assisted: Claude Code
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 this pull request may close these issues.

ComboBox fires change events on blur when isReadOnly, clearing a fully controlled value that is not in the collection

1 participant