feat(hooks): skip disabled items when opening with arrows#1696
Draft
wanxiankai wants to merge 1 commit into
Draft
feat(hooks): skip disabled items when opening with arrows#1696wanxiankai wants to merge 1 commit into
wanxiankai wants to merge 1 commit into
Conversation
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.
Pull Request
What
Skip disabled items when
useSelectoruseComboboxopens with ArrowDown or ArrowUp, and highlight the first enabled item in the requested direction.Closes #1593.
Why
The current open-on-arrow logic only checks index
0for ArrowDown and the last index for ArrowUp. If that edge item is disabled, the menu opens without an active descendant even when enabled items are available, which is confusing for keyboard and assistive-technology users.How
Reuse the existing
getNonDisabledIndextraversal helper fromgetHighlightedIndexOnOpen. The search begins at the first item for ArrowDown and the last item for ArrowUp. If every item is disabled, the helper preserves the existing-1result and the menu opens without a highlight.Changes
useSelectanduseComboboxin both arrow directions.Validation
npm run test:tsLocal Playwright execution was not available because the Chromium download CDN repeatedly reset the TLS connection; the repository CI matrix will run the end-to-end suite.
Checklist