diff --git a/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx b/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx index c2cab9dce..f7f43cff2 100644 --- a/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx +++ b/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx @@ -82,6 +82,35 @@ describe('FontAutocomplete', () => { ).toBe('JetBrains Mono') }) + it('shows the full list on focus when the committed font has multiple matching suggestions', async () => { + function Harness(): ReactNode { + const [value, setValue] = useState('Cascadia Mono') + return ( + + ) + } + + await act(async () => { + root.render() + }) + + await act(async () => { + getInput().focus() + }) + + expect(getOptionLabels()).toEqual([ + 'Arial', + 'Cascadia Code', + 'Cascadia Mono', + 'Cascadia Mono PL', + 'Consolas' + ]) + }) + it('keeps typed searches filtered even after the value updates', async () => { function Harness(): ReactNode { const [value, setValue] = useState('Geist') diff --git a/src/renderer/src/components/settings/SettingsFormControls.tsx b/src/renderer/src/components/settings/SettingsFormControls.tsx index 6af9a0f95..d60a72c69 100644 --- a/src/renderer/src/components/settings/SettingsFormControls.tsx +++ b/src/renderer/src/components/settings/SettingsFormControls.tsx @@ -630,12 +630,10 @@ export function FontAutocomplete({ () => filterFontSuggestions(suggestions, query), [suggestions, query] ) - // Why: a committed font fills the input, but typed searches can also mirror - // into `value`; only expand exact matches outside an active search session. + // Why: the committed font fills the input, but opening the chooser should + // still reveal every installed font instead of only fonts sharing that name. const visibleSuggestions = - !isFilteringQuery && normalizedQuery === normalizedValue && filteredSuggestions.length <= 1 - ? suggestions - : filteredSuggestions + !isFilteringQuery && normalizedQuery === normalizedValue ? suggestions : filteredSuggestions // Why: sync the highlighted index during render rather than via useEffect so // the correct item is highlighted on the very first paint after open/filter