Skip to content

LR-BEHAV-ACCESS: an icon button's accessible name is its label, with the shortcut as its description - #3253

Merged
aiongg merged 1 commit into
storytold:mainfrom
nledford:mac-a11y-shortcut-names
Oct 31, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
nledford:mac-a11y-shortcut-names

Conversation

@nledford

@nledford nledford commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Off main. From the macOS integration critique (27 Oct), VoiceOver walk-through, item 12.

Problem

Icon-only buttons take their accessible name from their tooltip, and the tooltip carries the shortcut: "Edit (E)", "Presets (Shift+P)", "Photo Grid (G)", "Import Photos… (⌘⇧I)". VoiceOver reads the name every time it lands on the control, so a person walking the tool strip hears the key of every button each time. On macOS the name is the bare label; the shortcut belongs in the help text (AXHelp), which VoiceOver reads after a pause or on request.

Change

  • widgets::accessible_label splits a trailing key hint off a tooltip ("Edit (E)" → label "Edit", hint "E"; ASCII or full-width brackets, because the Japanese and Traditional Chinese catalogs write "編集(E)") and puts the hint into the widget's AccessKit description. egui's on_hover_text only fills a description that is empty, so the hint stays, and the tooltip a sighted person sees is unchanged. A tooltip with no hint behaves as before.
  • One helper, two call sites: widgets::icon_button (the tool strip, the bottom bar's view buttons, Before/After and Filmstrip, the mask overlay buttons, White Balance Selector, the slideshow controls, and every other icon-only button) and the top bar's icon loop (Import Photos…). Every call site that passes a tooltip with a hint follows without edits; the Import and Show all overlays tooltips are built from shortcut_text, so the description is the platform's own glyphs ("⌘⇧I" on a Mac), no glyph is hard-coded.
  • Tests: tool_strip_and_toolbar_buttons_are_named_by_label_with_the_shortcut_as_description and import_button_describes_its_shortcut_as_this_platform_writes_it in crates/ui-egui/tests/it/accessibility.rs; a_trailing_key_hint_leaves_the_name and every_language_names_an_icon_button_by_its_label (all 17 catalogs) in widgets.rs. The Tab-order test found the tool strip by the name "Edit (E)"; it now finds the button named "Edit" whose description is "E" (the menu bar has an "Edit" menu too).
  • Docs: the LR-BEHAV-ACCESS row, Last updated and a revision row; docs/whats-new.md.

Not in this PR:

  • Text buttons and check boxes whose visible label contains the key ("Swap Aspect (X)", "Delete (⌫)", "Visualize Spots (A)"): the name has to contain the visible text for Voice Control, so they keep it.
  • The Japanese cloud-icon tooltip ends in full-width brackets that are not a shortcut ("ローカルのライブラリ(クラウドアカウント不要)"): its name becomes the text before the brackets and the rest is its description, so nothing is lost.
  • Shortcuts written in the catalog text in English style on macOS ("Shift+P" rather than "⇧P") are shown as the tooltip writes them; that glyph order is MENU-BAR: shortcuts list their modifiers in one order everywhere on macOS (⇧⌘I, not ⌘⇧I) #3200's subject for the menu bar.

How it was checked

  • cargo xtask ci passes on this branch (3613a85dcb, cargo xtask ci through the draft-branch wrapper: all 8 steps, 5,250 tests passed, 0 failed), with MENU-BAR: clippy passes on macOS again (Quit, About and Settings share one branch) #2973's one-file clippy fix for apps/lightcraft/src/native_menu.rs:492 applied uncommitted and reverted before pushing (main fails that lint, MENU-BAR: clippy passes on macOS again (Quit, About and Settings share one branch) #2973). An earlier run of this branch stopped at tests::slideshow::a_manual_slideshow_waits_for_the_arrow_keys (a layout-shift flake in Settings that this PR does not touch; my LRC-SS-LAYOUT: the Slideshow settings page no longer moves when the slide preview finishes rendering #2848 fixes it); the rerun at the head above passed.
  • Tests that fail without this change: both tests in accessibility.rs fail on origin/main (seen: a button named "Presets" describing "Shift+P", and a button named "Import Photos…" describing "Ctrl+Shift+I"; the Tab test's strip lookup finds nothing, so "Tab jumps up from Info (I)"). every_language_names_an_icon_button_by_its_label fails against the first version of the splitter that knew only ASCII brackets (assertion on "編集(E)"); all four pass at the head.
  • User-visible change: ran a release build with the demo library and read the macOS accessibility tree (the computer helper, read only, the app driven through the control channel only). main: AXCheckBox title "Edit (E)", AXHelp "Edit (E)"; "Presets (Shift+P)" / "Presets (Shift+P)"; "Photo Grid (G)" / "Photo Grid (G)"; AXButton "Import Photos… (⌘⇧I)" / "Import Photos… (⌘⇧I)". This branch: "Edit" / AXHelp "E"; "Presets" / "Shift+P"; "Photo Grid" / "G"; "Import Photos…" / "⌘⇧I". No real VoiceOver session was run (it needs a person's screen and keyboard).
  • Review: a fresh reviewer at 3613a85dcb

Screenshots

None: the painted buttons and their tooltips do not change; only the name and help a screen reader reads do.

Merging

Checklist

  • No new panic path in non-test code
  • New text on screen goes through tr() and has its key in crates/ui-egui/locales/*.json: no new text, the tooltips are the existing catalog entries
  • The feature's row in docs/parity-checklist.md is updated (🟡 stays); docs/gaps.md has no entry for this
  • New code has a caller
  • No new assets
  • Ready to merge

Summary by CodeRabbit

  • Accessibility
    • Screen readers now announce icon-only buttons using their labels, with keyboard shortcuts provided separately as descriptions. VoiceOver can read the shortcut after a pause or on request.
    • This behavior applies across supported languages, including Japanese and Traditional Chinese. Hover tooltips remain unchanged.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 59a5d00 and 3613a85.

Files selected for processing: 5
  • crates/ui-egui/src/panels/topbar.rs
  • crates/ui-egui/src/widgets.rs
  • crates/ui-egui/tests/it/accessibility.rs
  • docs/parity-checklist.md
  • docs/whats-new.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

Icon buttons now use their bare labels as accessible names and expose trailing shortcut hints as descriptions. Top-bar icons announce the accessible label. Hover tooltips remain unchanged. Tests and documentation cover the updated behavior.

Changes: Icon Button Accessibility

Layer / File(s) Summary
Accessible names and shortcut descriptions
crates/ui-egui/src/widgets.rs, crates/ui-egui/src/panels/topbar.rs, crates/ui-egui/tests/it/accessibility.rs, docs/parity-checklist.md, docs/whats-new.md
Icon buttons use the bare label as the accessible name and a trailing shortcut hint as the AccessKit description. Top-bar icons announce the accessible label while retaining the translated hover tooltip. Tests check shortcut descriptions, including the platform-specific Import Photos shortcut. Documentation records the updated behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • storytold/wordcraft issue 3164: This change names icon-only toolbar buttons, while the issue also tracks other unnamed controls.
  • storytold/wordcraft issue 3477: This change adds accessible names and separate shortcut descriptions for icon-only toolbar controls, while the issue tracks additional unnamed controls.

Suggested reviewers: aiongg

Merge Risk: Minimal · up to 3613a

Icon buttons expose shortcut hints separately while retaining hover text. No merge-blocking issue was identified.

Security architecture risk: Minimal · up to 3613a

The change reorganizes accessibility text without changing which actions buttons can perform or when they are enabled. No material security risk was identified in the reviewed changes.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated effect is limited to accessibility metadata for existing desktop controls. The inspected delta does not expand the set of executable actions or grant additional authority through tooltip content.

Trust Boundaries and Controls

  • observed — Icon buttons retain their enabled-dependent interaction sense and enabled/selected metadata. The top-bar loop retains its existing widget identity and click-to-command dispatch. The new label processing does not replace those controls.

Resilience and Maintainability Implications

  • inferred — The metadata update is scoped to the response ID and does not introduce a persistent transition or recovery workflow. The earlier source inspection reports that egui clears AccessKit state at each UI pass, so removing a shortcut should not leave a prior hint on the rebuilt node.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: icon buttons use their label as the accessible name and the shortcut as the description.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 8 functions across 3 files. (2 skipped: 2 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.0)

Clippy execution timed out

Comment @coderabbitai help to get the list of available commands.

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