fix(VAutocomplete): keyboard navigation with virtual scroll items#22778
Closed
hellozzm wants to merge 1 commit intovuetifyjs:masterfrom
Closed
fix(VAutocomplete): keyboard navigation with virtual scroll items#22778hellozzm wants to merge 1 commit intovuetifyjs:masterfrom
hellozzm wants to merge 1 commit intovuetifyjs:masterfrom
Conversation
When using VAutocomplete with many items and VVirtualScroll, keyboard navigation (ArrowUp/ArrowDown) only worked through visible items because VList's focusChild filters out non-rendered elements. This fix intercepts arrow key events in the menu and uses VVirtualScroll's scrollToIndex to properly navigate through all items. Fixes vuetifyjs#22770
Contributor
|
Please stop posting AI slop. There is nothing of value in this PR |
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.
Summary
When using VAutocomplete with many items (e.g., 100+), keyboard navigation with ArrowUp/ArrowDown only works through the currently visible items in the virtual scroll. This is because VList's
focusChildfunction filters out non-rendered DOM elements viaoffsetParentcheck, so items outside the viewport are not navigable.This fix intercepts ArrowUp/ArrowDown keydown events in the menu handler, tracks the current virtual list index, uses
VVirtualScroll.scrollToIndex()to scroll to the target item, and then focuses it.Playground Markup
Testing
Fixes #22770