Skip to content

fix(site): add visible keyboard focus to audit log rows, menus, and comboboxes - #30354

Merged
chrifro merged 5 commits into
mainfrom
fix/audit-log-focus-indicators
Oct 30, 2026
Merged

chrifro merged 5 commits into
mainfrom
fix/audit-log-focus-indicators

Conversation

@chrifro

@chrifro chrifro commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the axe Auditor finding "Focus indicator is missing" (WCAG 2.4.7, issue 2863090). The finding was reported on the Audit Logs page. The fix goes into the shared menu and combobox primitives, so every dropdown, context menu, and command/combobox list in the app gets a visible keyboard focus indicator, not just the audit page.

All indicators use the same 2px inset ring-content-link ring (#61A6FA) that Button, Link, Select, and other controls already use for focus.

  • Expandable audit log rows (AuditLogRow): the focusable div[role=button] had no focus style. TimelineEntry puts its focus-visible outline on the <tr>, which never receives focus. The ring now shows on :focus-visible.
  • All dropdown and context menu items (menuClasses, DropdownMenuRadioItem): focus only changed the background from #09090b to #18181b, and on radio items that looked the same as the checked state. The ring now shows on :focus-visible. Radix moves focus to the item under the pointer, so the ring also follows the mouse. This is intentional: it keeps the indicator visible when keyboard focus lands on the item under a resting cursor.
  • Command and filter combobox items (CommandItem, FilterComboboxItem): cmdk keeps DOM focus in the search input, so the ring keys off data-selected=true on the highlighted row. This covers the Workspaces filter (FilterComboboxItem), plus the Audit select filters, the New workspace template list, and other Combobox/Command-based pickers (CommandItem).
  • "See all templates" footer link in the New workspace popover (WorkspacesButton): adds the ring on :focus-visible.
  • Story: ProxyMenu OpenedWithKeyboard opens the menu with Enter, so Pixel captures the ring on a focused, checked radio item.
Before After
Audit row (keyboard focus)
Filter menu (keyboard focus on 2nd option)

Pixel snapshots cover the menu, combobox, and story changes across the app.

Decision log
  • Fixed the shared primitives instead of patching only the audit page. The same missing indicator affected every menu and combobox built on them, which explains the large number of Pixel snapshot changes.
  • Used an inset ring because TimelineEntry cells and menu content use overflow-hidden, which clips an outer ring.
  • Menu items: an earlier revision hid the ring while hovered. That left no indicator when keyboard focus landed on the item under a resting cursor, which on checked radio items brought back the original bug. The ring now follows :focus-visible everywhere.
  • Combobox items: the ring is on the highlighted row (data-selected), not on :focus-visible, because cmdk never moves DOM focus off the input. As a result, the highlighted row shows the ring for both mouse and keyboard users.

Generated by Coder Agents on behalf of @chrifro.

Expandable audit log rows had no focus indicator because the focus
style lived on the table row rather than the focusable element. Menu
items only changed background on focus, which matched the checked
state of radio items and had too little contrast.

Show an inset link-color ring on keyboard focus for both. Menu items
hide the ring while hovered because Radix moves focus to the pointer's
item, which Chrome treats as focus-visible.
…u story

Covers keyboard focus on the checked proxy radio item so Pixel
captures the focus ring.
@linear-code

linear-code Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

…nder the pointer

Hiding the ring on hover left no indicator when keyboard focus landed on
the item under a resting cursor, which on checked radio items recreated
the missing focus indicator. The ring now follows :focus-visible, so it
also shows when Radix moves focus to the hovered item.
…space footer link

The New workspace template options, the workspaces filter rows, and the
"See all templates" link only changed background color on focus. Add the
same inset content-link ring used for menu items. cmdk keeps focus in the
input, so the ring keys off data-selected on the highlighted row.
@chrifro chrifro changed the title fix(site): add visible keyboard focus to audit log rows and menu items fix(site): add visible keyboard focus to audit log rows, menus, and comboboxes Oct 5, 2026
@chrifro
chrifro marked this pull request as ready for review October 6, 2026 08:42
@chrifro
chrifro requested a review from aqandrew October 6, 2026 08:42

@aqandrew aqandrew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Particularly the consistency with other controls

A tiny (8px) nit I have is re: the focus ring for when AuditLogRow receives keyboard focus. Right now the TimelineEntry's vertical borders overlap the focus ring.

Image

Are we able to make it so that the focus ring stays on top? I think their affordance is negatively impacted if they're overlapped like that. Either way, approving to unblock you

@chrifro

chrifro commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@aqandrew Fixed in ca019eb. The timeline line is an absolutely positioned td::before, so it was painting over the row's inset ring. Making the focusable row relative puts it after the pseudo-element in paint order. The ring now stays on top, and the line still shows through everywhere else.

I checked this in the AuditLogRow/WithDiff story by sampling the pixel where the line crosses the ring: before the fix it was the border color rgb(39,39,42), after the fix it is the ring color rgb(97,166,250).

Generated by Coder Agents.

@chrifro
chrifro requested a review from aqandrew October 29, 2026 15:11
tracyjohnsonux added a commit that referenced this pull request Oct 29, 2026
Fixes DEQ-344

Fixes the axe Auditor finding "Focus indicator is missing" on `/agents`
(WCAG 2.4.7, Deque issue 2880281, DEQ-344).

All rings use the same `ring-content-link` token as `Button` and #30354.
This PR is class changes only. The fixes that need JS are split out:

- #31392: composer focus ring, shown only for keyboard focus.
- #31393: return focus when the chat search dialog closes.
- #31394 (stacked on this PR): scroll the whole sidebar tab into view on
focus.

- **AI spend trigger** (`UsageIndicator`): this is the flagged element.
It set `outline-hidden` and had nothing to replace it. It now shows a
2px inset ring on `:focus-visible`. The ring is inset because the button
fills the full height of the sidebar footer.
- **Account menu button** (`UserSidebarFooter`): gets the same inset
ring so the two adjacent footer buttons match. Before, it relied on the
browser default outline.
- **Number fields** (`AdvisorSettings`, `LifecycleSettingLayout`): the
inputs hide their outline and the label wrapper had no focus style. The
wrapper now gets a `focus-within` ring, the same pattern
`ChatSearchInput` uses.
- **Sidebar chat row kebab** (`ChatTreeNode`): stayed at `opacity-0`
when focused with the keyboard. It now shows, and the timestamp hides,
while anything in the row has `:focus-visible`. This matches hover and
`ProjectChatRow`.
- **Subagent expand/collapse toggle** (`ChatTreeNode`): it used
`invisible` (`visibility: hidden`), which removed it from the tab order,
so keyboard users could not expand subagents. It now uses `opacity-0`
and shows on `:focus-visible`, in place of the status icon.
`pointer-events-none` outside hover keeps touch behavior unchanged.
- **Clipped rings in `overflow-hidden` groups:** the right panel `+` /
Add panel split button (`RightPanelAddTabControl`), the Git diff
Unified/Split toggle (`GitPanel`), and the Debug panel run and step
headers (`DebugRunCard`, `DebugStepCard`) had their outer ring or
browser outline clipped by the rounded container. Only a sliver at the
divider showed. They now use an inset ring. The tool result image button
(`ToolResultImage`) uses an outline with a -2px offset instead, because
the image would cover an inset box-shadow.
- **Right panel tabs** (`SidebarTabView`): the tab strip scrolls
horizontally, which also clips vertically, so tab rings lost their top
and bottom edges. A closeable tab's close button also painted over the
tab's ring. The strip now has 2px padding offset by a negative margin,
so rings fit. In closeable tabs, the tab and its close button each draw
their own inset ring, like the `+` / Add panel split button, so it's
clear which half has focus.
- **Chat search results** (`ChatSearchResults`): focus stays in the
search input, and the arrow-selected row is set via
`aria-activedescendant`. That row showed only a `surface-tertiary/40`
tint (about 1.1:1 against the dialog). It now draws the inset
`content-link` ring. Hover doesn't set the selection, so mouse hover
keeps the plain tint.
- **Consistent treatment in the composer** (`AgentChatInput`,
`WorkspacePill`, `ContextUsageIndicator`): every pill now gets the model
selector's full-strength 2px `content-link` ring around the whole pill.
Pill dismiss `×` buttons ring their parent pill (`has-focus-visible`)
and highlight the `×`, instead of drawing Chrome's two-tone default
outline on the icon. The workspace pill, `+N` overflow, and MCP group
triggers gained the ring. The context usage ring lost its 40% opacity.
The badge row is `overflow-hidden` for overflow measurement, so pill
rings there are inset, and the composer's model selector is inset to
match.
- **Stories:** `UsageIndicator` `TriggerFocusedWithKeyboard`,
`ChatsSidebar` `ChatActionsTriggerFocusedWithKeyboard`, and
`RightPanelAddTabControl` `AddPanelFocusedWithKeyboard`, and
`SidebarTabView` `CloseableTabFocusedWithKeyboard` focus the trigger so
Pixel captures it. `ChatsSidebar` `ExpandCollapse` now toggles with the
keyboard, because `userEvent.click` does not apply CSS `:hover`. The
existing `LifecyclePageView` stories already focus the number inputs.

Menu items inside the AI spend dropdown are covered by #30354.

<details>
<summary>Implementation plan and decision log</summary>

**Scope.** Deque flagged one element. A scan of `site/src` found every
`outline-hidden`/`outline-none` that has no `focus-visible` or
`focus-within` replacement. Shared menu and combobox primitives are
already handled in #30354, and the remaining `components/` hits are
either non-interactive containers (Dialog, Popover, Drawer, Chart) or
already have a ring. The Agents-area hits fixed here are the trigger and
the two number fields. The composer is in #31392. A scan for
`role="button"` or `tabIndex=0` elements without focus styles in
`pages/AgentsPage` found none.

**Decisions.**
- Inset ring for the footer buttons. An outer ring would be clipped at
the footer and sidebar edges.
- Full-opacity rings. `/40` rings reach only about 2.1:1 (dark) and
1.8:1 (light), below the 1.4.11 minimum of 3:1. Full opacity is 7.9:1
and 5.2:1.
- Changes that need JS (composer Tab tracking, search focus return, tab
scroll on focus) are split into #31392, #31393, and #31394 so this PR is
easy to review.

**Verification.** In Storybook, the computed `box-shadow` shows
`rgb(97,166,250) 0 0 0 2px` on the focused trigger and lifecycle field,
and no ring when they're blurred. A Playwright tab-through of
`ChatsSidebar` confirms the kebab and subagent toggle become visible
with a ring on keyboard focus, Enter toggles subagents, and mouse hover
and click behave as before. Pixel sampling of focused screenshots shows
the ring on all four edges of the Add panel, New terminal, Unified, and
Split buttons, the Debug card header, and the tool result image. A
Playwright tab-through of the composer shows the same `rgb(97,166,250) 0
0 0 2px` ring on More options, the model selector, MCP and planning
pills (via their dismiss button), the workspace pill, and context usage.
Pixel sampling of the right panel tab strip, tabbing forward and
backward through `CloseableTabs`, `MultipleTabs`, and `GitWithBadge`,
finds the ring on all four edges of each focused tab that starts in
view. `pnpm check`, `pnpm lint`, `pnpm lint:types`, the
`UsageIndicator`, `AgentChatInput`, `ChatsSidebar`,
`RightPanelAddTabControl`, `GitPanel`, `DebugPanel`, and `Tool` story
tests, and the `ChatsSidebar` and `AgentsPageLayout` Vitest files pass.

**Not done.** No manual keyboard pass in Firefox or Safari yet.
`ux-input-needed`: design hasn't confirmed the inset ring style.

</details>

---

*Generated by Coder Agents on behalf of @tracyjohnsonux.*

---------

Co-authored-by: Jake Howell <jacob@coder.com>
@chrifro
chrifro merged commit 30898d5 into main Oct 30, 2026
25 checks passed
@chrifro
chrifro deleted the fix/audit-log-focus-indicators branch October 30, 2026 09:00
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 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.

2 participants