Repository navigation
Make context menus keyboard and screen reader operable - #1376
Open
captbaritone wants to merge 2 commits into
Open
captbaritone wants to merge 2 commits into
captbaritone wants to merge 2 commits into
Conversation
✅ Deploy Preview for tourmaline-kringle-c98715 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +1.21 kB (+0.25%) Total Size: 492 kB 📦 View Changed
|
captbaritone
force-pushed
the
a11y-menus
branch
3 times, most recently
from
October 15, 2026 17:00
4f3ab25 to
d68a5d8
Compare
Menu buttons (ContextMenuTarget): render the trigger as a focusable, labelled role="button" with aria-haspopup="menu" and aria-expanded. Enter, Space or ArrowDown opens the menu and focuses its first item. Opening with the mouse is unchanged and does not move focus. Menus (ContextMenu): role="menu", with menuitem / menuitemcheckbox (with aria-checked) / separator items and roving focus. Up/Down/Home/End move between items, Enter/Space activate, Right/Left (or Enter/Escape) open and close submenus, and Escape/Tab close the menu and return focus to the trigger. Activating an item from the keyboard also returns focus to the trigger. Handled keys don't propagate, so global hotkeys don't also act on them. Keyboard focus is shown with the existing hover highlight, via :focus-visible, so pointer users see no change.
captbaritone
force-pushed
the
a11y-menus
branch
from
October 15, 2026 17:19
d68a5d8 to
3a6739c
Compare
This branch has not been deployed
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.
Webamp's click-to-open menus can't be opened, navigated or closed from the keyboard, and screen readers don't see them as menus. These are the main window's Winamp Menu (
#option), the clutter bar's Options menu (O), the equalizer's Presets menu, and the playlist's Sort and Misc Options menus.Menu button (
ContextMenuTarget).handle) is now a focusablerole="button"witharia-haspopup="menu"andaria-expanded.labelprop for its accessible name: "Winamp Menu" (matching#option's existing title), "Options", "Presets", "Sort List" and "Misc Options".Menu (
ContextMenu)Roles:
role="menu"menuitem, ormenuitemcheckboxwitharia-checkedwhen they have acheckedprop<Hr>is aseparator<Parent>is amenuitemwitharia-haspopup/aria-expandedand a nestedmenuaria-label, so a parent's name doesn't include all of its children's text, and a checked item's name doesn't include the CSS "✓"Keyboard (roving focus, items are
tabIndex={-1}):stopPropagation(), so withenableHotkeyson, the arrow keys don't also change volume or seek..expandedclass.Visuals: keyboard focus uses the existing hover highlight via
:focus-visible. The menu is portalled outside#webamp, so this PR also suppresses the browser's own focus outline there. Mouse users see no change.Not in this PR
ContextMenuWrapper) get the same roles, and Escape closes them, but there's still no keyboard way to open them. Everything in them is also reachable from the Winamp Menu or as a button.Testing
ContextMenuTarget.test.tsx(12 tests) covers:tsc,eslint,prettier --checkandvitest run(220 passed) pass locally.