Skip to content

Keyboard accessibility and ARIA for column cog menu - #2873

Open
opensource-joe wants to merge 1 commit into
simonw:mainfrom
opensource-joe:fix/1964-cog-menu-keyboard-a11y
Open

Keyboard accessibility and ARIA for column cog menu#2873
opensource-joe wants to merge 1 commit into
simonw:mainfrom
opensource-joe:fix/1964-cog-menu-keyboard-a11y

Conversation

@opensource-joe

Copy link
Copy Markdown

Refs #1964

The column actions (cog) menu is currently mouse-only. The trigger is a bare SVG with a click handler — it isn't in the tab order — and the menu has no ARIA roles or keyboard navigation.

This adds keyboard support following the ARIA menu button pattern:

  • The cog trigger becomes a focusable role="button" with aria-haspopup="menu", aria-expanded, and an aria-label ("Column actions for {column}"). It opens with Enter / Space / ArrowDown.
  • The menu gets role="menu" and each item role="menuitem" with roving tabindex; Up/Down/Home/End move focus (wrapping).
  • Escape closes and returns focus to the trigger; Tab closes the menu.

Mouse behavior is unchanged. Diff is limited to datasette/static/table.js (+71/-2).

Note: I wasn't able to run the full Playwright suite headless in my environment, so a maintainer check in a browser would be welcome — happy to add a Playwright test for the keyboard flow if you'd like.

The column actions (cog) menu was mouse-only: the trigger had no keyboard
affordance and the menu had no ARIA roles or arrow-key navigation.

- Make the cog trigger a focusable role="button" with aria-haspopup="menu",
  aria-expanded, and an aria-label; open it with Enter/Space/ArrowDown.
- Add role="menu"/role="menuitem" and roving focus with Up/Down/Home/End.
- Escape closes and restores focus to the trigger; Tab closes the menu.

Refs simonw#1964

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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