Skip to content

fix(IconButton): stop looking pressed after a mouse click - #1343

Draft
marsian83 wants to merge 1 commit into
ClickHouse:mainfrom
marsian83:fix/iconbutton-pressed-after-click
Draft

marsian83 wants to merge 1 commit into
ClickHouse:mainfrom
marsian83:fix/iconbutton-pressed-after-click

Conversation

@marsian83

@marsian83 marsian83 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

After a mouse click, IconButton keeps its pressed colors until focus moves somewhere else, the same bug #1328 fixed for Button.
Each type styles :focus and :focus-within the same as :active.
A mouse click focuses the button, so when the mouse is released the pressed style stays.

Unlike Button, the selector here is plain :focus, so keyboard focus also gets the pressed colors through it. Removing it alone would drop that fill from keyboard focus.

  • Replaced :focus and :focus-within with :focus-visible in the pressed-style rule of primary, secondary, ghost, danger and info. The pressed style now shows while the button is held down or focused from the keyboard.
  • :focus-within goes completely: the only child is the icon <svg>, which can't take focus, so it only ever matched when :focus did.
  • Unchanged: the :active style, the :focus-visible outline, and the hover and disabled styles.

Links and tickets

Follow-up to #1328 (#524).

Good to know

  • CSS-only change in IconButton.module.css (5 rules), no token edits. The existing IconButton tests pass.
  • The full pre-PR chain from AGENTS.md passes locally, plus build:health_check.
  • The full Docker visual suite passes (1273 tests) with no snapshot changes.
  • SplitButton (:focus) is the last one with this pattern; I'll send it separately.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets) A clicked IconButton returns to its normal or hover colors on release; described in the changeset.
  • 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: CSS-only, see "Good to know".

Accessibility

  • Keyboard - focus with Tab still shows the outline and the pressed fill; the focused frame is pixel-identical before and after
  • Vision - no color changes

Tested on Chromium on Linux, on the Danger story

Screenshots

Click, then move the pointer away (Danger, dark theme) the red doesn't go away until clicked outside:

Before After
before click after click

Keyboard focus is unchanged:

after keyboard

@changeset-bot

changeset-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b8d444a

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

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant