Keyboard accessibility and ARIA for column cog menu - #2873
Open
opensource-joe wants to merge 1 commit into
Open
Conversation
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>
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.
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:
role="button"witharia-haspopup="menu",aria-expanded, and anaria-label("Column actions for {column}"). It opens with Enter / Space / ArrowDown.role="menu"and each itemrole="menuitem"with rovingtabindex; Up/Down/Home/End move focus (wrapping).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.