Skip to content

a11y: give icon-only chrome buttons accessible names#5

Open
chinesepowered wants to merge 1 commit into
stackblitz:mainfrom
chinesepowered:a11y-icon-button-labels
Open

a11y: give icon-only chrome buttons accessible names#5
chinesepowered wants to merge 1 commit into
stackblitz:mainfrom
chinesepowered:a11y-icon-button-labels

Conversation

@chinesepowered

Copy link
Copy Markdown

What

The icon-only buttons in the deck chrome had no accessible name. They rely on data-tip="…", which is rendered purely as a CSS hover tooltip:

[data-tip]::after { content: attr(data-tip); }

That content isn't exposed to assistive tech, so every dock / sidebar / grid / annotator button was announced as an unlabeled "button". CONTRIBUTING asks that engine changes stay "keyboard-accessible", so this closes the gap for screen-reader and voice-control users.

Changes

  • src/deck/Deck.tsxaria-label on prev/next, the sidebar & grid close buttons, and the dock's sidebar, grid, annotate, fullscreen (state-aware label), and presenter buttons. aria-pressed on the sidebar / grid / annotate toggles so their on state is conveyed.
  • src/deck/Annotator.tsxaria-label on every tool, color, size, undo, and clear button (colors and sizes get real names via small label maps), plus aria-pressed on the selected tool / color / size.

The existing data-tip tooltips are left untouched, so there is no visual or behavioral change — this is purely additive semantics.

Verification

  • npx tsc --noEmit
  • npm run build

The dock, the sidebar/grid close buttons, and the annotation toolbar are all icon-only. Their labels came only from `data-tip`, which is a CSS hover tooltip ([data-tip]::after { content: attr(data-tip) }) and is not exposed to assistive tech — so screen readers announced them as an unlabeled "button". Add aria-label to each, plus aria-pressed on the toggle buttons (sidebar, grid, annotate, and the tool/color/size selectors) so their on/off state is conveyed too. No visual or behavioral change.
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.

1 participant