Fix screen reader names of ComboBoxes and their items
Part of #1919 (screen reader support). This PR only covers dropdowns (ComboBox), so it is not meant to close that issue.
Problem
- Data-bound ComboBox items were announced by their type name, e.g.
Flow.Launcher.Core.Resource.LanguageorSystem.Windows.Media.FamilyTypeface. WhenAutomationProperties.Nameis not set, WPF names the item container after the item'sToString(). That affects both the open list and the selected value a screen reader reads on a closed ComboBox. - ComboBoxes that are not the direct
Contentof aSettingsCardhad no accessible name at all, e.g. the language selector, which sits in aStackPanelnext to the "Help us translate" link. iNKORE'sSettingsCard.SetAccessibleContentNameonly names its direct content, from a stringHeader.
Changes
Using the WPF UI Automation properties (AutomationProperties.Name / AutomationProperties.LabeledBy):
-
Item names: an
ItemContainerStylesetsAutomationProperties.Nameon eachComboBoxItem, bound to the same property that is displayed (Display,DisplayName,Description, or the typeface'sAdjustedFaceNames[en-us]). The styles are based on iNKORE'sDefaultComboBoxItemStyle, so the look is unchanged. Shared styles are inSettingWindowStyle.xaml. The bundled plugins define their own copy, so they don't depend on a new host resource key. -
ComboBox names:
AutomationProperties.LabeledBywhere a visible label element exists. OtherwiseAutomationProperties.Name="{DynamicResource …}"with the same localized string as the card header, so the name follows runtime language changes. This also covers ComboBoxes that are directSettingsCardcontent. iNKORE'sSettingsCardalready names those fromHeader, but only once inOnApplyTemplate, so after a runtime language switch the name used to stay in the previous language. -
New strings (en only):
queryBoxFontStyle,resultItemFontStyle,resultSubItemFontStyle, and in Explorerplugin_explorer_previewpanel_date_format_label/plugin_explorer_previewpanel_time_format_label. -
Language changes: after a language change, the ComboBox text and the item names used to keep the previous language in two places:
DropdownDataGeneric.Displaynow raisesPropertyChanged.UpdateLabelsrewrites it in place, and the generated*Localizedclasses already notified.- Explorer's
EnumBindingModelnow derives fromBaseModeland has anUpdateLabelsthat raisesPropertyChangedforDescription.OnCultureInfoChangedcalls it for the three engine lists, so the option objects and the current selection are kept.
Apart from these two small C# changes, the changes are XAML only.
Tested with NVDA
Tested manually with NVDA on the CI build of this branch (1.20.2.1), with the UI in Traditional Chinese:
| Where | ComboBox | NVDA reads |
|---|---|---|
| Welcome wizard | Language | 「語言 下拉式方塊 系統」 (Language, combo box, System). Items: 系統, English, 中文, 中文(繁体). After selecting, it reads 中文(繁体) |
| Settings → General | Search Window Location | 「搜尋視窗位置 下拉式方塊 帶有滑鼠游標的顯示器」 (… Monitor with Mouse Cursor) |
| Settings → General | Search Window Position on Monitor | 「搜尋視窗在螢幕上的位置 下拉式方塊 置中」 (… Center) |
| Settings → General | Query Search Precision | 「查詢搜尋精確度 下拉式方塊 一般」 (… Regular) |
| Settings → General | Last Query Style | 「最後查詢樣式 下拉式方塊 選擇上一個查詢」 (… Select last query) |
| Settings → General | History Style | 「History Style 下拉式方塊 Query history」. Items: Query history, Last opened history |
History Style is read in English because that string has no zh-TW translation yet.
The other changed ComboBoxes have not been tested with a screen reader yet. They were checked with a script that hosts the edited XAML and reads it through the UI Automation client:
- Settings → General: language, custom monitor number, Dialog Jump (window position, result behaviour, file result behaviour), Double Pinyin schema
- Settings → Theme: query box / result title / result subtitle font and font style, backdrop type, clock format, date format, animation speed, color scheme, code highlight theme
- Settings → About: log level, setting window font
- Settings → Plugins: display mode filter. Plugin Store: sort mode
- Default browser and default file manager windows
- Plugin settings: Calculator (including the new history creation mode from #4454), Explorer, Web Search, Shell, Browser Bookmark
Not in this PR (next steps for #1919)
- Other controls still lack accessible names, e.g. the sliders in the theme size editor (
ui:ControlHelper.Headerdoes not set a name) and text boxes such as the custom window position and custom animation length. - Found during the NVDA test:
- Welcome wizard: the Next and Back buttons contain only an icon and are read as just "button".
- Settings → General: the toggle switch in the header of the "Start Flow Launcher on system startup" expander is read without a name. iNKORE's
SettingsExpandernames only itself, not itsContent, so everySettingsExpanderheader toggle is probably affected.
🤖 Generated with Claude Code