Skip to content

fix(site/src/pages/TemplateBuilder): use shared Checkbox in ModuleCard - #30540

Merged
chrifro merged 3 commits into
mainfrom
a11y-module-card-checkbox
Oct 30, 2026
Merged

chrifro merged 3 commits into
mainfrom
a11y-module-card-checkbox

Conversation

@chrifro

@chrifro chrifro commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

The template builder's module cards drew their own checkbox with a border-secondary border. That border is 1.70:1 against the card in dark mode and 2.33:1 in light mode, below the 3:1 non-text contrast that WCAG 1.4.11 requires. The cards now use the shared Checkbox, so they get the border-control tokens from #30462 (3.67:1 dark, 4.40:1 light, measured on the card's surface-secondary background), plus the shared hover and focus styles.

The card itself is no longer a role="checkbox", so the real checkbox is the only control, labelled by the module name. The checkbox has no change handler of its own. Its clicks, including Space, bubble up to the card's existing onClick, so clicking anywhere on the card still toggles it.

Stacked on #30462, which adds the border-control tokens. Retarget to main once that merges.

Fixes DEQ-148

Before and after

Captured from the ModuleCard stories. I also checked clicking the checkbox, pressing Space on it, and clicking the card on the Modules step of the running app.

Before After
Dark, unchecked
Dark, checked
Light, unchecked
Light, checked
Decision log
  • Shared Checkbox instead of only swapping the token. Changing border-border-secondary to border-border-control on the hand-drawn box would fix the contrast in one line, but the box would still miss future Checkbox changes and have no hover or focus state.
  • The card is a plain clickable div. Putting the Radix checkbox (a <button>) inside a role="checkbox" card would give two tab stops for one choice. The card click is a mouse shortcut. Keyboard users tab to the checkbox, and the click-events-have-key-events exception says so, following the pattern in InputGroupAddon.
  • No onCheckedChange. Letting the checkbox's click bubble to the card keeps the card's onClick unchanged and avoids a double toggle without extra guards.
  • Focus moves from the card to the checkbox. The focus ring is now on the 18px box, not around the whole card.
  • Out of scope: clicking "View details" still toggles the module, as it did before this PR. TemplateCard draws its radio by hand in the same way. Both can follow up separately.

Generated by Coder Agents on behalf of @chrifro.

Add border-control and border-control-hover color tokens and use them
for the resting and hover borders of the shared Checkbox and
RadioGroupItem components. The previous borders (border-default and
border-secondary) fell below the 3:1 non-text contrast required by
WCAG 1.4.11.

border-control is zinc-500 in both themes. border-control-hover is
zinc-400 in dark mode and zinc-600 in light mode.
The module card drew its own checkbox with a border-secondary border,
which failed the 3:1 non-text contrast ratio. It now renders the shared
Checkbox, so it picks up the border-control tokens, hover and focus
styles. The card is no longer itself a role=checkbox, which removes the
nested View details link from inside the control, and clicking that
link no longer toggles the selection.
@linear-code

linear-code Bot commented Oct 9, 2026

Copy link
Copy Markdown

DEQ-148

@chrifro
chrifro marked this pull request as ready for review October 9, 2026 11:38
@chrifro
chrifro requested a review from aqandrew October 9, 2026 11:39
…ange

Let the checkbox's clicks bubble to the card's existing onClick instead
of adding a change handler and a click guard, and leave the details link
behavior unchanged.
Base automatically changed from a11y-control-border-token to main October 14, 2026 08:52
@chrifro
chrifro merged commit ce7f38c into main Oct 30, 2026
34 of 35 checks passed
@chrifro
chrifro deleted the a11y-module-card-checkbox branch October 30, 2026 09:03
@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