Skip to content

fix(site/src): add visible keyboard focus ring to menu and combobox items - #30356

Closed
chrifro wants to merge 1 commit into
mainfrom
fix-menu-focus-indicators
Closed

chrifro wants to merge 1 commit into
mainfrom
fix-menu-focus-indicators

Conversation

@chrifro

@chrifro chrifro commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Menu items, combobox options, and the New workspace "See all templates" link only changed background color on keyboard focus (surface-primary to surface-secondary). That is below the 3:1 contrast WCAG 2.4.7 requires, and a checked radio item already has that background, so focusing it showed no change at all. Reported by the Deque audit of /workspaces (issues 2867143 and 2871494, dark and light mode).

This adds a 2px inset ring-content-link focus ring to the shared primitives, so every dropdown, context menu, and combobox gets it:

  • menuItemClass (DropdownMenuItem, CheckboxItem, SubTrigger, ContextMenu items) and DropdownMenuRadioItem: focus-visible, so it only appears for keyboard focus.
  • CommandItem and the FilterCombobox row: data-[selected=true], because focus stays in the cmdk input and the browser can't tell keyboard highlighting apart from mouse hover. The ring also shows on hover in these lists.
  • "See all templates" link in WorkspacesButton: focus-visible.

On main, the workspaces page uses FilterCombobox in place of the preset radio menu the audit saw on staging, so both are covered.

Ring contrast against the focused item background: about 4.7:1 in light mode (#2463EB on #F4F4F5) and about 7:1 in dark mode (#61A6FA on #18181B).

Before / after

Captured from ./scripts/develop.sh in light mode, using only the keyboard.

Element Before After
New workspace: template option (arrow key)
New workspace: "See all templates" (Tab)
Workspaces filter row (arrow key)
Filters preset: checked + focused
Workspace Actions menu: Delete…
Decision log and verification
  • Fixed in shared primitives rather than per page, because every audited element is a DropdownMenu, Command, or FilterCombobox item and the same gap exists app-wide.
  • Used ring-inset so the ring is not clipped by overflow-hidden menu containers and does not shift layout.
  • Used focus-visible for Radix menu items so mouse users don't see the ring; cmdk lists can't make that distinction, so they key off data-selected.
  • Verified with Playwright against the dev server: the computed box-shadow on each focused element includes the 2px inset ring, in both light and dark themes, including the checked + focused radio item.
  • make pre-commit and make pre-push passed.

Generated by Coder Agents on behalf of @chrifro.

…tems

Menu items, combobox options, and the New workspace "See all templates"
link only changed background color on focus, which falls below the 3:1
contrast WCAG 2.4.7 requires. Add a 2px inset content-link ring.
@chrifro

chrifro commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #30354, which now includes these changes (combobox items, workspaces filter rows, and the New workspace "See all templates" link). The shared DropdownMenu changes overlapped with #30354.

Generated by Coder Agents on behalf of @chrifro.

@chrifro chrifro closed this Oct 5, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant