feat(Select): add aria-label prop and printable-char typeahead to SelectActivator - #635
Open
sridhar-3009 wants to merge 3 commits into
Open
feat(Select): add aria-label prop and printable-char typeahead to SelectActivator#635sridhar-3009 wants to merge 3 commits into
sridhar-3009 wants to merge 3 commits into
Conversation
…ectActivator (closes vuetifyjs#613)
Contributor
|
✅ Changeset found — this change will be included in the next release. Thanks! |
Add browser tests for SelectActivator.label (aria-label prop) and the typeahead keyboard handler that delegates to useVirtualFocus.typeahead. The typeahead test mounts with attachTo: document.body so that items are in the live document and document.querySelector resolves element refs, which is required for applyHighlight to succeed. Add unit tests for useVirtualFocus.typeahead: forward search from current position, case-insensitive matching, wrap-around, disabled item skipping, no-match no-op, all-disabled early return, and el-less item handling.
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.
SelectActivatoris a combobox trigger but had no way to carry an accessible label when the visible label is in a sibling element, and no typeahead for keyboard users. This closes both gaps.Changes
packages/0/src/components/Select/SelectActivator.vuelabelprop → emitted asaria-labelon the activator (passed through toSelectActivatorProps/SelectActivatorSlotProps.attrs)onKeydown, when the listbox is open and a printable character key is pressed (single char, no Ctrl/Meta/Alt modifier), delegates tocontext.virtualFocus.typeahead(e.key)— jumps virtual focus to the first non-disabled item whose text content starts with that characterpackages/0/src/composables/useVirtualFocus/index.tstypeahead(char: string) => voidmethod onVirtualFocusReturn(interface + implementation)highlight()on itWCAG coverage
aria-labelon the combobox satisfies the accessible name requirement when the label element is not associated via<label for>Closes #613.