Repository navigation
input: Name the mask toggle - #3424
Closed
counterbeing wants to merge 1 commit into
Closed
counterbeing wants to merge 1 commit into
counterbeing wants to merge 1 commit into
Conversation
4 tasks done
The eye button added by `mask_toggle()` shows only an icon, so screen readers announced it as just "button" and accessibility-driven UI tests could not find it by name. Applications can't name it either, because Input creates it internally. It is now named for the action it takes, "Show password" while the value is masked and "Hide password" while it is shown, localized for en, zh-CN, zh-HK and zh-TW. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
counterbeing
force-pushed
the
a11y-sidebar-caret-input-mask
branch
from
October 13, 2026 22:00
2085965 to
491b8be
Compare
Member
|
Close old no response PRs, if you want continue, you can just reopen. |
2 of 4 tasks
huacnlee
pushed a commit
that referenced
this pull request
Oct 16, 2026
## Description The clear button that `Input`, `Select`, `Combobox` and `DatePicker` show with `cleanable(true)` is icon-only and has no accessible name. Screen readers announce it as just "button" (TalkBack: "Unlabelled, button"), and accessibility-driven UI tests can't find it by name. Applications can't name it either, because the component creates it. It is now named "Clear", localized for en, zh-CN, zh-HK and zh-TW like the other `Input` strings. The mask toggle of a masked input has the same gap. #3424 named it (closed for inactivity, and its author can reopen it), so this PR leaves the toggle out. I found this while testing Kit on Android through gpui-mobile, where every clear button is an unnamed `android.widget.Button`. ## Screenshot No visual change; this only adds an accessible name. Android (OnePlus CPH2581, Android 16), an `Input` with `cleanable(true)`: | Before | After | | --- | --- | | `uiautomator dump`: `class="android.widget.Button" text="" content-desc=""` ([full dump](https://raw.githubusercontent.com/Bombatomica64/Gpui-android/main/docs/demos/a11y-text-input-baseline.xml)) | `content-desc="Clear"`; TalkBack reads "Clear" and activates it | ## How to Test - New UI test `input::clear_button_is_named`: renders a cleanable `Input` and checks the button's label is "Clear". - `cargo test -p gpui-kit --features test-support --test integration -- input:: input_focus::`: 191 passed (187 `input::`, incl. the new test, and 4 `input_focus::`) - `cargo test -p gpui-base --features test-support --lib input`: 359 passed - `cargo clippy -p gpui-base -p gpui-component -p gpui-kit --features gpui-kit/test-support --tests -- --deny warnings`, `cargo fmt --all -- --check`, `typos`: clean. - On Android, in my test app (Kit 0.7.1 plus this change, through gpui-mobile): uiautomator shows `content-desc="Clear"`, and TalkBack focuses and activates the button. ## Checklist - [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and followed the guidelines. - [x] 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. (Not run: no desktop session here; the UI test covers the label.) - [ ] Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) (Not platform-specific; a label only.) Thanks for taking the time to review this. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 of 4 tasks
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.
Description
The show/hide toggle that
Input::mask_toggleadds 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 PR originally also named the
SidebarMenuItemsubmenu 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 and reviewed by me.
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 (392 passed). The new testinput::mask_toggle_is_named_for_the_action_it_takeschecks the toggle reads "Show password", then "Hide password" after a click; it fails onmainwithout 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.Checklist
cargo runfor story tests related to the changes.