Skip to content

fix(Button): use the global focus ring on secondary, empty and danger - #1308

Open
JayPokale wants to merge 2 commits into
ClickHouse:mainfrom
JayPokale:fix-button-focus-ring
Open

JayPokale wants to merge 2 commits into
ClickHouse:mainfrom
JayPokale:fix-button-focus-ring

Conversation

@JayPokale

@JayPokale JayPokale commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

The secondary, empty and danger variants of Button show no usable focus ring when focused with the keyboard (#1305). Each variant drew its :focus-visible outline from its own stroke-active token:

  • empty: transparent, so nothing changes on focus.
  • danger: the danger stroke at about 5% opacity, roughly 1.08:1 in light and 1.03:1 in dark.
  • secondary: #cccfd3 in light (1.56:1) and #3a383c in dark (about 1.4:1), under the 3:1 that WCAG 1.4.11 asks for.

Before the CSS Modules setup in #810, Button extended BaseButton and got the global ring from #894. Since #810 it renders its own <button>, so that rule no longer reaches it.

This sets the outline color of those three variants to --click-global-color-outline-default, the same ring BaseButton, IconButton, Checkbox, Switch and the other form controls use (#437eef light, #faff69 dark). Width and offset are unchanged. The fill and border changes on focus are unchanged.

primary is unchanged. Its ring already comes from a visible token, and whether it should also use the global ring is a design call (the issue raises the same question).

Links and tickets

Closes #1305

Good to know

  • CSS-only change in Button.module.css (3 lines), no token edits. A :focus-visible outline color cannot be asserted in jsdom, so there is no new unit test. The existing Button and ButtonGroup tests pass (35).
  • I did not build Storybook or run the Docker visual tests for this one, so the ring has not been checked by eye. The colors come from the token that the neighbouring components already use.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets) Focus ring color of three Button variants; described in the changeset.
  • Design review needed? Only if you want primary to use the global ring too.

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: CSS-only, see "Good to know".

Accessibility

  • Keyboard - focus behavior is unchanged; only the ring color changes.
  • Vision - colors come from a token; WCAG 2.4.7 Focus Visible, 1.4.11 Non-text Contrast.

Note

Low Risk
CSS-only focus-ring color on three button variants; no logic, API, or token definition changes.

Overview
Keyboard focus visibility for Button secondary, empty, and danger is fixed by swapping each variant’s :focus-visible outline from its own low-contrast stroke-active token to --click-global-color-outline-default, matching IconButton, Checkbox, and the other form controls.

Outline width, offset, and focus-time border/background styling are unchanged. primary still uses its variant stroke for the ring. A patch changeset documents the visual update.

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

@changeset-bot

changeset-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d098ece

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 bug Something isn't working a11y Accessibility improvements labels Nov 16, 2026
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 670 stories published Open Storybook
UI Tests ⏳ 3 changes must be accepted as baselines Open build

Built from commit: d098ece7015cee4e9cbde284c3387b6d178f2142 · Chromatic run

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

@XOP

XOP commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Hi @JayPokale , thank you for the PR!

VRT caught some expected diffs, can you please run yarn test:visual:update and commit the updates?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility improvements bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Empty and Danger buttons show no visible focus ring, and Secondary's is under 3:1

2 participants