Skip to content

fix(a11y): show a focus ring on Checkbox, Switch and RadioGroup - #1291

Merged
XOP merged 5 commits into
ClickHouse:mainfrom
kachdan:fix/form-controls-focus-visible
Nov 12, 2026
Merged

XOP merged 5 commits into
ClickHouse:mainfrom
kachdan:fix/form-controls-focus-visible

Conversation

@kachdan

@kachdan kachdan commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Checkbox, Switch and RadioGroup items show no focus indicator when you Tab to them, in both themes
  • FormRoot has .form-root * { outline: none; box-shadow: none; } and none of these three define a :focus-visible style, RadioGroup also sets outline: none on .radio-input itself, so the browser ring gets removed and nothing replaces it
  • Added a :focus-visible rule to .checkinput, .switch and .radio-input with the same 2px ring BaseButton and IconButton use (--click-global-color-outline-default, 2px offset), the class plus pseudo class beats the FormRoot reset without touching FormRoot

Links and tickets

None, I didn't find an existing issue. Same approach as #894 which added focus outlines to the buttons and triggers

Good to know

  • I left the FormRoot reset alone on purpose, removing it could change how the text fields and Select look, so this only adds rings where they were missing
  • The Checkbox and Switch focus specs screenshot only the control itself, so a ring drawn outside it with the 2px offset may not show up there, that's also why the current checkbox focus snapshot is identical to the default one. The RadioGroup focus spec screenshots the whole group so that one should change. I couldn't run the Docker visual tests on my side so nothing is regenerated here, if you want the Checkbox and Switch specs to capture the ring they would need to screenshot a little padding around the control
  • I also didn't run the full local checks, it's the same 2 line rule in 3 CSS files and the before and after below is from the published Storybook with the rule applied

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets)
  • Design review needed?

Contribution

  • Sufficient research before PR
  • Self-reviewed the PR
  • Manually tested the changes (when applies - visual confirmation in Storybook)
  • build and build-storybook work locally
  • Tests and Stories are aligned with the changes

Accessibility

Checked with Tab and Shift+Tab on the Checkbox, Switch and RadioGroup default stories in light and dark, the ring now shows on all three and uses the same token as BaseButton, IconButton and the Select trigger. That covers WCAG 2.4.7 Focus Visible. I didn't test with a screen reader since names and roles don't change here, and I didn't check target size, the checkbox and radio are still 16px

  • Keyboard - every action works with Tab / Enter / Space / Esc; focus is visible and returns to the trigger on close
  • Names — every control has a name that includes its visible label; icon-only controls take aria-label
  • Vision — colors come from tokens, focus ring shows, targets are at least 24×24 px

Screenshots

Focused with the Tab key, before and after, light and dark

Click UI · Form controls focus ring

Note

Low Risk
CSS-only focus styling on three form controls; no logic, API, or FormRoot behavior changes.

Overview
Adds keyboard focus-visible outlines to Checkbox, Switch, and RadioGroup so Tab focus is visible again inside forms. FormRoot clears outlines on descendants and these controls had no replacement ring (RadioGroup also set outline: none on the input).

Each control now gets the same 2px token ring (--click-global-color-outline-default, 2px offset) as Button / IconButton, without changing FormRoot. A patch changeset records the visual a11y fix.

Reviewed by Cursor Bugbot for commit 2ca055f. Bugbot is set up for automated code reviews on this repo. Configure here.

FormRoot resets outline on every descendant, and none of these controls
defined a focus-visible style, so keyboard focus was invisible on all
three. Add the same 2px focus ring BaseButton and IconButton use.
@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2ca055f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@XOP XOP added enhancement New feature or request a11y Accessibility improvements labels Nov 5, 2026
@XOP
XOP requested review from DreaminDani and XOP November 5, 2026 10:14
@XOP XOP mentioned this pull request Nov 10, 2026
2 of 8 tasks
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 670 stories published Open Storybook
UI Tests ⏳ 1 change must be accepted as baseline Open build

Built from commit: 2ca055f96e5176bf6e82104f5a1358965cb072d2 · Chromatic run

Statuses as of the end of the run. The build link shows the live review state.

@XOP
XOP merged commit d86b2df into ClickHouse:main Nov 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility improvements enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants