Repository navigation
fix(site/src/pages/TemplateBuilder): use a real radio group for base template cards - #31865
Conversation
…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.
…ve-4 # Conflicts: # site/src/pages/TemplateBuilder/BaseInfraSelectStep.tsx
bartekgatzcoder
left a comment
There was a problem hiding this comment.
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.
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 reportsnested-interactiveon every card.The card now uses the shared
RadioGroupItemin place of the hand-drawn indicator, labelled by the template name, andBaseInfraSelectStepwraps the grid in the sharedRadioGroupcontrolled byselectedBaseId. 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, matchingModuleCard(#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
Decision log
onClickis the only caller ofonSelectand a selection is never counted twice. Covered byTemplateCard.test.tsx.oxlint-disable-next-line jsx-a11y/click-events-have-key-eventscomment, asModuleCarddoes.ModuleCard.TemplateCardstories render inside aRadioGroupdecorator, which the radio needs.TemplateCardDefault and Selected go fromnested-interactiveandtarget-size(1 node each) to 0.TemplateBuilderPageViewDefault goes from 2 nodes each to 0. A pre-existinglink-in-text-blockhit in the page subtitle remains.nested-interactivefixes: 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.