Skip to content

ui-react: the theme radiogroup is three tab stops with no arrow keys #2580

Open

Description

@schlessera

Context

Part of #2576.

(ThemeToggle, packages/ui-react/src/components/layout/theme.tsx:39-68) renders role="radiogroup" with three <button role="radio"> options (System, Paper, Dark). Every option is its own tab stop and the arrow keys do nothing. The radio pattern requires one tab stop with arrows moving and selecting inside the group, and the kit already fixed this defect for its own groups (design-feedback.md §11, "Every tab and radio in the kit was its own tab stop"). It renders in Settings, Appearance & input (packages/ui-react/src/components/settings/settings-panel.tsx:207).

Native radio inputs supply the whole contract: one tab stop, arrows that move and select, and a checked state that assistive technology already knows. Guide html/html: "DO use <button> for triggered actions … and <a> strictly for URL navigation". Selection is neither of those, so it belongs on a radio input.

Scope

  • Render the group as a <fieldset> (or role="radiogroup" container) named "Theme", holding three <label>s that each contain a visually hidden <input type="radio" name=… value=…> and the visible label text. onChange calls setTheme.
  • Move the selected and hover paint onto the label: label:has(:checked) for selected and label:has(:focus-visible) for the focus ring. The current bk-row hover veil and title hint stay.
  • Remove the raw-button: select marker, since no raw button remains.

Out of scope

  • Theme logic (useUIStore theme/setTheme, useApplyTheme).
  • Changing the option set, labels, order or paint.
  • Other radiogroups (kit groups already rove).

Acceptance criteria

  • Tab reaches the group once. ArrowLeft/Right/Up/Down move and select, Space selects, and Tab leaves the group.
  • The accessibility tree exposes a group named "Theme" with three radios, one checked, matching useUIStore theme.
  • Selected, hover and focus paint match the current baselines in both themes, at 320px and ≥900px.
  • A browser keyboard test (one Tab stop, ArrowRight changes the theme) fails on the current tree and passes after. Record the failing-first run in the PR.
  • packages/ui-react/tests/render/render-smoke.test.tsx and packages/ui-react/tests/browser/remaining-buttons.cases.tsx are updated to the new roles.

Verification

bun run test packages/ui-react/tests/render/render-smoke.test.tsx
node scripts/visual.mjs --project=ui-react-layout --filter=settings
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

ThemeToggle takes no props, and only its rendered elements change.

Activity

  1. added
    type: fix
    area: ui-react
    priority: p2
    agent-ready
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-reactpriority: p2type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions