Repository navigation
sidebar: Name the submenu caret button for assistive tech - #3470
Merged
Merged
Conversation
The submenu caret is a real control — it has its own on_click that toggles the submenu and its own tab stop — but it shipped with no accessibility name, so screen readers announced an unnamed 'button' once per expandable item, and deterministic role+label audits fail on every instance. Name it from the item it acts on via a small pure helper (mirroring collapsed_tooltip), and unit-test the wording. Fixes longbridge#3467
noosxe
force-pushed
the
sidebar-caret-accessible-name
branch
from
October 12, 2026 22:39
3a4ed1c to
1e3827e
Compare
Member
|
This overlaps with #3424, which already names the same caret and adds a rendered-control test covering both Expand and Collapse. That draft also respects an explicit |
This was referenced Oct 13, 2026
huacnlee
pushed a commit
that referenced
this pull request
Oct 16, 2026
## Description The show/hide toggle that `Input::mask_toggle` adds to a masked input shows only an icon and has no accessible name, so screen readers announce it as just "button" and accessibility-driven UI tests can't find it by name. Applications can't name it either, because Input creates it internally. This PR names it for the action it takes: "Show password" while the value is masked and "Hide password" while it is revealed, matching how the Input docs describe the toggle. The new strings (`Input.Show Password`, `Input.Hide Password`) are localized for en, zh-CN, zh-HK and zh-TW. For example, a settings window with a masked API-token field previously exposed one unnamed button next to it; it now reads "Show password". No override builder is added: an override would need a pair of state-dependent names, so I left it out to keep the change small. Happy to add one (for example for a field that holds a token rather than a password) if you'd like it. This replaces #3424, which was closed as stale while it was a draft; it's rebased onto current `main`. (#3424 originally also named the `SidebarMenuItem` submenu caret; #3470 has since done that, so it's now limited to the mask toggle.) AI-assisted: the change, tests and description were drafted with Claude. ## Screenshot No visual change. This only adds an accessible name. ## How to Test - `cargo test -p gpui-kit --features gpui-kit/test-support --locked --test integration`: passed locally before the rebase; after rebasing onto current `main`, `input::` passes (187 tests). The new test `input::mask_toggle_is_named_for_the_action_it_takes` checks the toggle reads "Show password", then "Hide password" after a click; it fails on `main` without the source change. - `cargo clippy --workspace --exclude gpui-shell --exclude gpui-webview --exclude webview --locked -- --deny warnings`: passed locally. - `cargo check -p gpui-component --no-default-features --locked`: passed locally. - `cargo fmt --all --check`: passed locally. - Story: in the Input story, the masked input's eye button (States section, and Password under Content type) shows "Show password" / "Hide password" in Accessibility Inspector. ## Checklist - [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and followed the guidelines. - [ ] Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate. - [ ] Passed `cargo run` for story tests related to the changes. - [ ] Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
The
SidebarMenuItemsubmenu caret is a real control — its ownon_clicktoggles the submenu (withstop_propagation), its own tab stop — but it ships with no accessible name. Screen readers announce an unnamed "button" once per expandable item, and deterministic role+label audits (the kind apps run as committed receipts) FAIL on every instance.Buttonalready supports.accessibility_label(...); this names the caret from the item it acts on, via a small pure helper next tocollapsed_tooltipso the wording is unit-testable the same way.Fixes #3467
Before / after
Repro of the before-state: any
Settings-style nav that buildsSidebarMenuItem::new(page).children(...)(pages with >1 titled groups); dump the accessibility tree — one unlabeledButtonper expandable page.Test plan
submenu_caret_is_named_after_the_item(mirrors the existingcollapsed_tooltiptests)cargo test -p gpui-component --lib sidebar::— 19 passedcargo clippy -p gpui-component --all-targets -- -D warnings— cleancargo fmt -p gpui-component --check— clean