fix(web): font picker highlights and Enter-selects the first match after typing - #45
Merged
Merged
Conversation
…ter typing Typing in an Appearance font picker did not visibly highlight the first match, arrows misbehaved, and Enter did nothing, so the only way to apply a font was to click it. LegendList only re-renders a row when its item or extraData changes, so a font that stayed visible while the filter shifted its position kept a stale index. Base UI's combobox highlights and Enter-selects by index, so it targeted the wrong or an unmounted row. Pass the full collection as items and the filtered list as filteredItems, and give LegendList the filtered list as extraData so every filter change re-renders the visible rows with fresh indices. Base UI's own highlight, arrow navigation, hover, and Enter path then work as-is. Claude Fable 5 via Claude Code (initial implementation by GPT-5.6 Sol via Codex CLI)
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.
Problem
Typing in any Settings > Appearance font picker (Interface, Prompt, Code, Terminal) did not visibly highlight the first match, up/down navigation misbehaved, hovering could show two highlighted rows, and Enter did nothing. The only way to apply a font was to click it with the mouse.
Root cause:
@legendapp/listmemoizes each row's rendered element on[itemKey, item, extraData]only. When the filter changes, a font that stays visible while its position shifts keeps a staleindexprop. Base UI's combobox is index-keyed (highlight isactiveIndex === index, Enter clickslistRef[activeIndex]), so it highlighted the wrong or an unmounted row and Enter clicked nothing.Fix
itemsand the filtered list asfilteredItems(same pattern as the branch selector and model picker).extraData, so every filter change re-renders the visible rows with fresh indices. Base UI's own highlight, arrows, hover, and Enter path then work unchanged.Verified in the web app: typing highlights the first match, up/down move a single highlight from the search input, Enter applies.
Note:
BranchToolbarBranchSelectorandModelPickerContenthave the same latent stale-index issue with their virtualized lists; left for a follow-up.Claude Fable 5 via Claude Code (initial implementation by GPT-5.6 Sol via Codex CLI)