Repository navigation
fix(site/src/pages): scroll the whole sidebar tab into view on focus - #31394
Draft
tracyjohnsonux wants to merge 18 commits into
Draft
tracyjohnsonux wants to merge 18 commits into
tracyjohnsonux wants to merge 18 commits into
Conversation
The AI spend trigger in the Agents sidebar footer removed the browser outline without a replacement (WCAG 2.4.7, Deque DEQ-344). Add an inset content-link ring on focus-visible, and match it on the adjacent account menu button. Also fix the chat composer ring, which targeted a textarea while the editor is a contenteditable, and raise it to full opacity for 3:1 contrast. Add focus-within rings to the Advisor and Lifecycle number fields, whose inputs hide their outline.
The chat row actions trigger stayed at opacity 0 when focused with the keyboard, and the subagent expand toggle used visibility hidden, which removed it from the tab order. Show both on focus-visible, matching their hover behavior.
…ontrols Buttons inside overflow-hidden containers (the right panel add-tab split button, Git diff style toggle, Debug panel cards, and tool result images) had their outer focus ring or browser outline clipped. Draw the ring inset, or as an inward outline for the image button whose content would cover an inset ring.
Composer pills now share the model selector's full-strength 2px content-link ring around the whole pill. The dismiss X rings its parent pill instead of drawing the browser outline on the icon, the workspace pill and +N/MCP group triggers get the ring, and the context usage ring drops its 40% opacity. Rings in the clipped badge row are inset. Add a base :focus-visible outline in the same color and width so raw elements without their own focus style no longer fall back to the browser's default two-tone outline.
The editor is focused programmatically on load and after sends, and browsers treat every contenteditable focus as focus-visible, so the composer looked keyboard-focused before any input. Show the ring only when focus reaches the editor via Tab; the caret marks other focus.
The tab strip scrolls horizontally, which also clips vertically, so tab focus rings lost their top and bottom edges. A closeable tab's close button also painted over the tab's ring, and focus scrolled only the focused half of a closeable tab into view. Pad the strip for the ring, ring closeable tabs as one pill like the composer badges, and scroll the whole pill clear of the scroll chevrons on focus.
…ages The composer sits flush with the top of a vertically scrolling wrapper on the chat page (and the mobile create form frame), which clipped the ring's top edge. Pad the wrappers by the ring width, offset by a negative margin so the layout does not shift.
Ringing the whole tab and close pill when either half had focus made it unclear which control was focused. Give the tab and close button their own inset ring, matching the add-tab split button.
Search keeps DOM focus in the input and marks the arrow-selected result with aria-activedescendant. That row was shown only by a background tint with about 1.1:1 contrast. Draw the inset content-link focus ring on it.
Radix dialogs restore focus only to a Dialog.Trigger, and the chat search dialog opens from the sidebar button or Ctrl+K, so dismissing it left focus on the document body. Remember the element focused on open and return to it on close, unless the dialog closed by navigating to a result.
Browsers already draw a visible default outline on raw elements, and each real failure is fixed in its component. The global rule only recolored that outline app-wide.
Keep this PR to class-only focus indicators. The composer keyboard-only ring, the chat search focus return, and the tab scroll-into-view on focus each move to their own PR.
Tabbing to a closeable tab's close button scrolled only the button into view, leaving its focus ring clipped at the scroller edge.
…s-agents-page # Conflicts: # site/src/pages/AgentsPage/components/ChatElements/tools/ToolResultImage.tsx
…sidebar-tab-scroll-on-focus
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>
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.
Part of DEQ-344, split out of #30689 because it uses JS rather than classes alone. Stacked on #30689.
In the sidebar tab strip, tabbing to a closeable tab's × scrolls only the × into view, so the tab half and its ring stay clipped at the scroller edge. An
onFocushandler on the scroller now scrolls the whole pill into view, andscroll-px-9keeps it clear of the add-tab control.Generated by Coder Agents on behalf of @tracyjohnsonux.