Skip to content

input: Name the mask toggle - #3562

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
counterbeing:a11y-sidebar-caret-input-mask
Oct 16, 2026
Merged

huacnlee merged 1 commit into
longbridge:mainfrom
counterbeing:a11y-sidebar-caret-input-mask

Conversation

@counterbeing

Copy link
Copy Markdown
Contributor

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

  • I have read the CONTRIBUTING 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)

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>
@huacnlee
huacnlee merged commit 4c46923 into longbridge:main Oct 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants