Skip to content

selectBox: fix character navigation skipping last matching option#306579

Open
xingsy97 wants to merge 2 commits intomicrosoft:mainfrom
xingsy97:wt/selectbox-character-nav
Open

selectBox: fix character navigation skipping last matching option#306579
xingsy97 wants to merge 2 commits intomicrosoft:mainfrom
xingsy97:wt/selectbox-character-nav

Conversation

@xingsy97
Copy link
Copy Markdown
Member

Problem

SelectBoxList.onCharacter() mimics native <select> keyboard navigation: pressing a letter key should cycle through options whose text starts with that letter. The loop iterates this.options.length - 1 times instead of this.options.length, so one candidate position is never checked. When the only remaining match is at the skipped position—typically the currently selected option after a full cycle—pressing the character key does nothing.

Fix

Change the loop bound from this.options.length - 1 to this.options.length so all positions are checked.

Copilot AI review requested due to automatic review settings March 31, 2026 03:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes custom select box “type-to-select” behavior so character navigation checks all options (including the currently selected one), matching native <select> cycling semantics and avoiding no-op keypresses when the only match is at the previously skipped position.

Changes:

  • Adjusted SelectBoxList.onCharacter() loop bound to iterate this.options.length times (instead of this.options.length - 1) so every candidate index is evaluated.

@xingsy97 xingsy97 marked this pull request as ready for review March 31, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants