Repository navigation
Conversation
New useListbox (src/internal/components/listbox/use-listbox.ts) owns the list state shared by list components: highlight, keyboard navigation, the choose guard, mouse handlers, row props and the selected-announcement flag. useSelect calls it and keeps the dropdown concerns: trigger, open state, filter, dialog, focus, Escape, the highlight on open and embedded focus. Its props and return values are unchanged. No behavior change and no existing test changed.
…ultiselect Moves the live region announcement (useAnnouncement) from Select and Multiselect into useListbox, and the scroll-to-highlighted ref and effect into useSelect. Both components pass the same getParent, selectedAriaLabel and renderHighlightedAriaLive as before. No behavior change.
amanabiy
marked this pull request as ready for review
November 3, 2026 14:58
amanabiy
requested review from
a team,
srungta08,
vikaskale2722 and
vvaliyev
and removed request for
a team,
srungta08 and
vikaskale2722
November 3, 2026 14:58
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor/share-listbox-helpers #5239 +/- ##
==================================================================
+ Coverage 97.77% 97.84% +0.07%
==================================================================
Files 1004 1008 +4
Lines 32566 32629 +63
Branches 12100 12108 +8
==================================================================
+ Hits 31841 31926 +85
+ Misses 719 697 -22
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ScrollToIndexRef moves to listbox/interfaces.ts, SelectListProps is renamed to ListProps, and the PlainList/VirtualList prop menuProps is renamed to listProps, so the shared list code no longer uses Select names. useListbox imports the ref type from interfaces instead of a component file. Two use-listbox docstrings now say exactly when activeDescendantId is undefined and when scrollToIndex is called. No behavior change.
amanabiy
changed the base branch from
refactor/move-shared-listbox-parts
to
refactor/share-listbox-helpers
November 4, 2026 08:49
useListbox is the only caller of useMenuKeyboard and already calls the option onEscape, so the option now has one name end to end. It describes the key, not the dropdown. No behavior change.
Move the onFocus and onBlur handlers of the embedded Multiselect list
from useSelect into useListbox, behind getListProps({ embedded }). The
rule is the same as before: focus highlights the first option if
nothing is highlighted, and blur clears the highlight. No behavior
change.
vvaliyev
approved these changes
Nov 4, 2026
This branch was successfully deployed
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.
Description
Stacked on #5249.
Adds an internal
useListboxhook, built from the shared listbox helpers in #5249, and buildsuseSelecton it, so Select and Multiselect share one list engine. No behavior change for Select or Multiselect.useListboxowns:useMenuKeyboard) and choosing an optionlistRefandgetListProps({ withKeyboard, embedded })useSelectwith the same rule: focus highlights the first option when nothing is highlighted, blur clears the highlightOpen state, the filter, type-ahead and the highlight on open stay in
useSelect, because they differ per component.Also:
menuProps→listProps)useMenuKeyboardoptioncloseDropdowntoonEscapeRelated links, issue #, if available: n/a
How has this been tested?
useListbox(use-listbox.test.tsx), including the embedded focus handling.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.