fix: start arrow key navigation from selected item when no item is highlighted#1400
Open
terminalchai wants to merge 1 commit into
Open
Conversation
…tem is highlighted When a dropdown is closed without confirming a selection and then reopened, _onDirectionKey() had no highlighted item in the DOM. The fallback was to get the first selectable choice, so arrow key navigation always restarted from item 0 instead of from the currently confirmed selection. Fix: when there is no highlighted item, fall back to the currently selected item (is-selected) as the navigation reference for getAdjacentEl(). If neither exists (first open, nothing selected), the original first-item fallback is preserved. Add an e2e test to select-one.spec.ts that verifies ArrowDown after a close-without-confirm resumes navigation relative to the selected item. Fixes Choices-js#1371
f4b0ed4 to
d1177e4
Compare
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
Tests