Skip to content

fix(site/src/components): show the dropdown highlight ring only for keyboard navigation - #30682

Merged
chrifro merged 7 commits into
mainfrom
a11y-combobox-keyboard-only-ring
Nov 13, 2026
Merged

chrifro merged 7 commits into
mainfrom
a11y-combobox-keyboard-only-ring

Conversation

@chrifro

@chrifro chrifro commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Note

This PR was generated by Coder Agents on behalf of @chrifro.

Follow-up to #30472. The blue ring on highlighted dropdown options also showed on mouse hover, which made the menus feel heavy without helping pointer users. It now shows only when the keyboard moved the highlight.

cmdk uses one highlight (data-selected) for both arrow keys and hover and doesn't record which one moved it. A small useHighlightSource hook on the cmdk root tracks this: a document keydown sets data-highlight-source="keyboard", pointermove on the root sets "pointer", and focus starts from the last input on the page, so a menu reached with Tab shows the ring right away. Keys are tracked on the document because the Agents slash menu gets its arrow keys from the composer editor, outside the cmdk root. Items apply the ring only under in-data-[highlight-source=keyboard]. It's wired into the shared Command/CommandItem (which covers the Agents slash menu and MultiSelectCombobox) and FilterComboboxRoot/FilterComboboxItem. The hover background and the focus-visible rings on chip and flyout buttons are unchanged.

WCAG 2.2 still passes: 2.4.7 Focus Visible and 1.4.11 Non-text Contrast apply to the keyboard indicator, which is unchanged (7.0:1 dark, 4.7:1 light). Neither criterion requires a pointer hover indicator.

/workspaces filter menu:

Mouse hover, before Mouse hover, after Keyboard (ArrowDown), unchanged
before hover after hover after keyboard

Agents composer slash menu (/agents, type /):

Mouse hover, before Mouse hover, after Keyboard (ArrowDown), unchanged
agents before hover agents after hover agents after keyboard
Verification
  • Playwright on the dev server, /workspaces: hovering a row leaves box-shadow: none; ArrowDown adds the 2px inset content-link ring; hovering again removes it.
  • Playwright on the dev server, /agents slash menu: the ring shows after typing / and on ArrowDown, hides on hover, and returns on the next ArrowDown from the composer.
  • New Command.test.tsx covers keyboard/pointer switching, keys pressed outside the root, and the initial state on focus.
  • vitest unit (Command, Filter, MultiSelectCombobox, ChatMessageInput): 307 tests pass.
  • make pre-commit passes.

…eyboard navigation

cmdk highlights a row on both arrow keys and pointer hover without recording
which caused it. Track the last input source on the cmdk root and apply the
content-link ring only when the keyboard moved the highlight.
…outside the cmdk root

The Agents slash menu takes its arrow keys from the composer editor, so the
root never saw them and the ring stayed hidden after a hover. Track key
presses on the document while a menu is mounted.
@chrifro
chrifro requested review from aqandrew and jakehwll October 13, 2026 11:42
@chrifro
chrifro marked this pull request as ready for review October 13, 2026 11:43
tracyjohnsonux added a commit that referenced this pull request Nov 6, 2026
… options and space flyouts 4px from the menu (#31814)

Fixes DES-22264

Two fixes for the filter menu on `/workspaces`:

- **Muted option text.** Options without an icon ("Workspace is..."
Outdated, Dormant) always rendered in `content-primary`. They now use
`content-secondary` until hovered, highlighted, or selected, like the
status options.
- **4px flyout gap.** Owner/Template/Organization flyouts now sit 4px
from the main menu (`sideOffset={4}`). The gap made the flyout close
while the pointer crossed it, because the wrapper's `onMouseLeave`
fired. Invisible 4px strips on both sides of the wrapper bridge the gap,
so the flyout stays open whether it opens right or left.

The hover focus ring is out of scope; #30682 handles it.

> Generated by Coder Agents on behalf of @tracyjohnsonux.
Comment thread site/src/components/Command/Command.tsx Resolved
@chrifro
chrifro temporarily deployed to main November 11, 2026 08:10 — with GitHub Actions Inactive
@chrifro
chrifro requested a review from aqandrew November 11, 2026 08:10
…d-only-ring

# Conflicts:
#	site/src/components/Command/Command.tsx
@chrifro
chrifro temporarily deployed to main November 11, 2026 09:14 — with GitHub Actions Inactive
@chrifro
chrifro temporarily deployed to main November 11, 2026 10:41 — with GitHub Actions Inactive
@chrifro
chrifro temporarily deployed to main November 12, 2026 10:09 — with GitHub Actions Inactive
@chrifro
chrifro merged commit e207d7d into main Nov 13, 2026
28 of 29 checks passed
@chrifro
chrifro deleted the a11y-combobox-keyboard-only-ring branch November 13, 2026 08:49
@chrifro
chrifro temporarily deployed to docs-preview November 13, 2026 08:49 — with GitHub Actions Inactive
@chrifro
chrifro temporarily deployed to main November 13, 2026 08:49 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 2026

This branch was previously deployed

2 inactive deployments
docs-preview — e412005f Deployed Nov 13, 2026 by chrifro via cleanup #19
main — e412005f Deployed Nov 13, 2026 by chrifro via cla #255997
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.

3 participants