[TreeView] Use the order in which the items are displayed for type-ahead #12827
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.
Fixes #12826
Not sure if this is a bug fix or just a behavior change.
The current type-ahead was alphabetical, if you have the items
["A3", "A2", "A1"]
, you focus"A3"
and press"a"
, the focus goes to"A1"
because it's the 1st matching item alphabetically.This PR switches for a search based on the displayed order (you focus
"A2"
because it is the 1st matching item below the currently focused one.IMHO this is a lot more consistent, it's the approach taken by this TreeView for instance.
Nice side-effect, we no longer generate the list of the 1st letter of every item on each keystroke
Now that
getNextNavigableItem
is cheap it's a lot more efficient that wayFollow up
Add test in #12811