Auto focus the first item within Combobox when the filtered items change #9189
+6
−2
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.
Closes #8007
This PR gets the ball moving for #8007. As mentioned in the issue, users sometimes get confused after typing a query in a ComboBox and hitting enter only to have the suggestions menu close (even if it's an exact match). I think it makes sense to auto-focus the first suggestion when the query text changes:
After:
https://github.com/user-attachments/assets/6eebe44f-32c4-4a12-a2b8-2b52831a8174
Before:
https://github.com/user-attachments/assets/f079bb21-84be-4232-b78c-23db2a404a57
There's a few discussion points:
disableAutoFocusFirstprop be added, as inAutocomplete? This will change API.✅ Pull Request Checklist:
📝 Test Instructions:
I'm using the
React Aria Components/ComboBox/Combo Box Examplestory. (packages/react-aria-components/stories/ComboBox.stories.tsx). Type the characterF,Foois not automatically focused. Additionally, typeFooand hit enter - window closes, despite an exact match with the first suggestion.🧢 Your Project: