Repository navigation
fix(site/src): move the Autocomplete clear button out of the trigger - #31856
Conversation
…he trigger The clear control was a span with role="button" nested inside the trigger button, which axe reports as nested-interactive. It is now a real button rendered beside the trigger and positioned over the same spot.
…s original position right-8 left the button 1px right of where it sat inside the trigger, because it ignored the trigger's 1px border.
…ing rows buttons (#31857) Template rows used `useClickableTableRow`, which rendered `<tr role="button" tabIndex={0}>` around the "Create Workspace" link, so axe reports `nested-interactive` on every row. Rows are now plain table rows with the existing hover outline and a mouse-only click that opens the template. The template name is a real link to the template page (shared `Link` with `asChild`, same pattern as `WorkspaceTopbar`), so keyboard and screen reader users reach the template through it. The name link stops propagation like the Create Workspace button already does, so Ctrl/Cmd-click opens a new tab without also navigating the current one. Closes DEQ-46 Closes DEQ-94 Closes DEQ-237 Closes DEQ-293 Closes DEQ-311 | Ticket | Surface | |---|---| | DEQ-46, DEQ-94, DEQ-237, DEQ-293, DEQ-311 | Templates list (`/templates`) rows | The resting state is pixel-identical to `main`. The only visible change is keyboard focus: it moves from the whole row to the template name, which gets the standard `content-link` focus ring. <details> <summary>Decision log</summary> - Chose a real name link over the `WorkspacesTable` precedent of dropping `role` but keeping `tabIndex={0}` on the row. A focusable row without a role doesn't tell assistive technology it navigates, and `site/AGENTS.md` requires a semantic role for `tabIndex={0}`. - `Link` overrides (`pl-0 font-semibold text-inherit visited:text-inherit`) keep the title's existing look; computed color, weight, and size match `main` in both themes. - Verified with axe-core in Storybook (`pages/TemplatesPage` WithTemplates, MultipleOrganizations, ClassicParameterFlowWarning): `nested-interactive` goes from 6/6/3 nodes to 0. A pre-existing minor `empty-table-header` remains on both. - New `TemplatesPage.test.tsx` opens a template from the name link with the keyboard; it fails on `main`. - The rest of the `nested-interactive` batch ships separately (#31856 for `Autocomplete`). </details> 🤖 Generated by Coder Agents on behalf of @jeremyruppel.
bartekgatzcoder
left a comment
There was a problem hiding this comment.
Round 1: changes needed. The fix works: the clear control is now a real <button> beside the trigger, so nested-interactive is resolved, every caller's className move checks out, and label wiring is unchanged. Three should-fix items before this can merge:
- [should-fix] New focus state has no story (
Autocomplete.tsx:412, TS1/FE1). The clear button gains a visiblefocus-visiblering the old span never had, but no story captures it for Pixel. Add a story (for exampleClearButtonFocused) whoseplayonly tabs to or focuses "Clear selection", with no assertions. - [should-fix] Long single-line class list (
Autocomplete.tsx:412, site/AGENTS.md class-list rule). Split it intocn(...)groups: position, box/reset, hover, focus. - [should-fix] Stale workaround comment (
site/src/pages/AgentsPage/components/ProjectPage/ProjectAccessDialog.tsx:283-284, outside the diff).// Its clear control would nest a button inside the trigger button.next toclearable={false}is false once this PR lands. Either drop the comment andclearable={false}(the clear control is now safe there), or reword the comment to the real reason for keeping it disabled.
Nits:
Autocomplete.tsx:375: the rewrite droppedcn(...)and left a bare multiline template literal, which site/AGENTS.md asks to avoid.placeholder:text-content-secondarythere has no effect on a<button>.Autocomplete.tsx:412:p-0 border-0 bg-transparent cursor-pointerduplicate preflight andindex.cssbase rules.right-[33px]is border (1px) +px-3(12px) + chevronsize-5(20px). Worth a line in the PR body.Autocomplete.stories.tsx:349-369: the editedClearSelectionplay still assertsonChangeSpyand text content. The new Vitest test coversonChange(null), so the play can stop at the click.- Focus drops to
bodyafter clearing. This matchesmain, but returning focus to the trigger would be a small improvement while this control is being rewritten.
Follow-ups filed (pre-existing, not blocking): DEQ-621 (trigger aria-haspopup="listbox" but popup is a dialog); evidence added to DEQ-176 (sharing picker has no label).
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
…closure button (#31858) The audit log row header was a `<div role="button" tabIndex={0} aria-expanded>` that contained the description links and the request details tooltip trigger, so axe reports `nested-interactive` on every expandable row. The chevron is now a real disclosure button (`CollapsibleTrigger` around a `<button aria-label="View changes">`), which gets `aria-expanded` and `aria-controls` from Radix and handles Enter and Space natively. The header div keeps its click handler as a mouse-only shortcut, with no role, tab stop, or key handler. The button stops propagation so a click toggles once. Closes DEQ-28 Closes DEQ-106 Closes DEQ-211 Closes DEQ-250 Closes DEQ-317 Closes DEQ-392 Closes DEQ-438 | Ticket | Surface | |---|---| | DEQ-28, DEQ-106, DEQ-211, DEQ-250, DEQ-317, DEQ-392, DEQ-438 | Audit log (`/audit`) expandable rows | <details> <summary>Decision log</summary> - Kept the row-wide click for mouse users, matching current behavior, with an `oxlint-disable-next-line jsx-a11y/click-events-have-key-events` comment, as `ModuleCard` does (#30540). Keyboard users use the disclosure button. Dropping the row click would avoid the comment but shrink the mouse target to the 24px chevron. - The button's name is a static "View changes"; the expanded state comes from `aria-expanded`. - Replaced the two `fireEvent.keyDown` tests in `AuditPage.test.tsx`, which exercised the removed row key handler, with one `userEvent` test that toggles the button with Enter, Space, and a click and checks it toggles once each time. - Verified with axe-core in Storybook (`pages/AuditPage/AuditLogRow` WithDiff, WithOrganization, NoDiff): `nested-interactive` goes from 1 node to 0 in the diff stories. A `target-size` hit on the request details tooltip trigger in WithOrganization also clears, since it no longer sits inside the oversized row button. - Related `nested-interactive` fixes: #31856 (`Autocomplete`), #31857 (templates list). </details> 🤖 Generated by Coder Agents on behalf of @jeremyruppel.
…template cards (#31865) The base template card in the template builder was a `<div role="radio" tabIndex={0}>` with its own Enter and Space handling, and it contained the "View details" link, so axe reports `nested-interactive` on every card. The card now uses the shared `RadioGroupItem` in place of the hand-drawn indicator, labelled by the template name, and `BaseInfraSelectStep` wraps the grid in the shared `RadioGroup` controlled by `selectedBaseId`. The group gets one Tab stop with arrow-key navigation. The card keeps its click handler as a mouse-only shortcut with no role, tab stop, or key handler, matching `ModuleCard` (#30540). Closes DEQ-50 Closes DEQ-60 Closes DEQ-61 Closes DEQ-166 Closes DEQ-197 Closes DEQ-205 Closes DEQ-242 Closes DEQ-445 Closes DEQ-452 | Ticket | Surface | |---|---| | DEQ-50, DEQ-60, DEQ-61, DEQ-166, DEQ-197, DEQ-205, DEQ-242, DEQ-445, DEQ-452 | Template builder, step 1 (pick a base template) | <details> <summary>Decision log</summary> - The radio has no change handler. Clicks, Space, and Radix's arrow-key selection all reach the card as clicks, so the card's `onClick` is the only caller of `onSelect` and a selection is never counted twice. Covered by `TemplateCard.test.tsx`. - Kept the card-wide click for mouse users with an `oxlint-disable-next-line jsx-a11y/click-events-have-key-events` comment, as `ModuleCard` does. - The selected radio now uses the shared style (gray border, 10px dot) instead of the custom one (white border, 8px dot). Size and position are unchanged. Focus moves from a ring around the whole card to a ring around the radio, offset against the card surface. - Clicking "View details" still selects the card on the way out, as before and as in `ModuleCard`. - `TemplateCard` stories render inside a `RadioGroup` decorator, which the radio needs. - Verified with axe-core in Storybook: `TemplateCard` Default and Selected go from `nested-interactive` and `target-size` (1 node each) to 0. `TemplateBuilderPageView` Default goes from 2 nodes each to 0. A pre-existing `link-in-text-block` hit in the page subtitle remains. - Related `nested-interactive` fixes: #31856 (`Autocomplete`), #31857 (templates list), #31858 (audit log). </details> 🤖 Generated by Coder Agents on behalf of @jeremyruppel.
# Conflicts: # site/src/components/Autocomplete/Autocomplete.test.tsx # site/src/components/Autocomplete/Autocomplete.tsx
…unused clearable prop
|
Addressed the remaining review-summary items:
Generated by Coder Agents on behalf of @jeremyruppel. |
bartekgatzcoder
left a comment
There was a problem hiding this comment.
Round 2: all three should-fix items are resolved. The ClearButtonFocused story only tabs to the clear button, the class lists use cn(...) groups, and the stale clearable={false} workaround is gone from ProjectAccessDialog along with its unused pass-through. Verified at e5efea9: axe shows no violations on the Autocomplete stories or the ProjectAccessDialog Manage stories, the focus ring is visible on "Clear selection", and Enter or a click clears the value; tsc, biome, oxlint, and the affected Vitest suites (88 tests) pass. Follow-up filed: DEQ-625 (focus drops to body after clearing, which matches main and was deferred by the author).
🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.
The Autocomplete clear control was a
<span role="button" tabIndex={0}>nested inside the trigger<button>, which axe reports asnested-interactive.It is now a real
<button type="button" aria-label="Clear selection">rendered as a sibling of the trigger inside arelativewrapper, and absolutely positioned over a 24px spacer kept in the trigger so the layout is unchanged. TheclassNameprop moves to the wrapper; every non-inline caller only passes width classes. The inline search mode is untouched.Closes DEQ-511
Autocomplete, also used by template permissions, chat/project sharing, and AI settings ACL dialogs)Decision log
stopPropagation()removed from the clear handler: it only existed to stop the click reaching the trigger. Callers' ancestors were checked; none has a click or pointer handler, and the button istype="button"so enclosing forms don't submit.right-[33px]is the trigger's 1px border, 12pxpx-3, and 20px chevron box.ProjectAccessDialogno longer passesclearable={false}, which only existed to avoid the nested button, and the now-unusedclearablepass-through onUserOrGroupAutocompleteis removed.mainbehavior.nested-interactivebatch also covers the templates list, audit log, and template builder base-template cards; those ship as separate PRs. The "Select modules" tickets were already fixed by fix(site/src/pages/TemplateBuilder): use shared Checkbox in ModuleCard #30540.🤖 Generated by Coder Agents on behalf of @jeremyruppel.