Repository navigation
input: Name the mask toggle - #3562
Merged
huacnlee merged 1 commit intoOct 16, 2026
Merged
Conversation
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>
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 replaces #3424, which was closed as stale while it was a draft; it's rebased onto current
main.(#3424 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.
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 currentmain,input::passes (187 tests). 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.