Skip to content

fix(site/src/pages/TemplateBuilder): use a real radio group for base template cards - #31865

Merged
bartekgatzcoder merged 3 commits into
mainfrom
a11y/nested-interactive-4
Nov 10, 2026
Merged

bartekgatzcoder merged 3 commits into
mainfrom
a11y/nested-interactive-4

Conversation

@jeremyruppel

Copy link
Copy Markdown
Collaborator

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)
Decision log
  • 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: fix(site/src): move the Autocomplete clear button out of the trigger #31856 (Autocomplete), fix(site/src/pages/TemplatesPage): link template names instead of making rows buttons #31857 (templates list), fix(site/src/pages/AuditPage): toggle audit log diffs with a real disclosure button #31858 (audit log).

🤖 Generated by Coder Agents on behalf of @jeremyruppel.

…template cards

The base template card was a focusable role="radio" div containing a
"View details" link, which nests interactive content. Use the shared
RadioGroup and RadioGroupItem instead and keep the card click as a mouse
shortcut, matching ModuleCard.
@linear-code

linear-code Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

@jeremyruppel
jeremyruppel marked this pull request as ready for review November 6, 2026 18:49
@jeremyruppel
jeremyruppel requested a review from aqandrew November 6, 2026 18:50
@jeremyruppel
jeremyruppel temporarily deployed to main November 10, 2026 14:41 — with GitHub Actions Inactive

@bartekgatzcoder bartekgatzcoder 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.

Clean fix: the card is no longer a role=radio wrapping the "View details" link; the shared RadioGroup/RadioGroupItem gives one Tab stop, arrow-key selection, and radios named by the template name, which also addresses the checked/unchecked announcements noted on DEQ-166. Verified in Storybook (axe: no nested-interactive on all 7 TemplateCard stories and TemplateBuilderPageView Default; arrows, Space, card click, and View details each select once; fits at 320px), and the TemplateBuilder tests pass. Nits: Enter no longer selects a card (matches the radio pattern; worth a line in the PR body); the "bubble up" comment at TemplateCard.tsx:43 assumes no enclosing <form>. Follow-up filed: DEQ-620 (pre-existing link-in-text-block on the page subtitle).

🤖 Generated by Coder Agents on behalf of @bartekgatzcoder.

@bartekgatzcoder
bartekgatzcoder merged commit 6358834 into main Nov 10, 2026
26 of 27 checks passed
@bartekgatzcoder
bartekgatzcoder deleted the a11y/nested-interactive-4 branch November 10, 2026 16:03
@bartekgatzcoder
bartekgatzcoder temporarily deployed to main November 10, 2026 16:03 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026

This branch was previously deployed

1 inactive deployment
main — 5d911066 Deployed Nov 10, 2026 by bartekgatzcoder via cla #253506
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