Skip to content

fix(Button): stop looking pressed after a mouse click - #1328

Merged
XOP merged 2 commits into
ClickHouse:mainfrom
marsian83:fix/button-pressed-after-click
Dec 1, 2026
Merged

XOP merged 2 commits into
ClickHouse:mainfrom
marsian83:fix/button-pressed-after-click

Conversation

@marsian83

@marsian83 marsian83 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

After a mouse click, Button keeps its pressed colors until focus moves somewhere else (#524).
Each variant styles :focus:not(:focus-visible, :disabled) the same as :active.
A mouse click focuses the button without :focus-visible, so when the mouse is released the pressed style stays.

The pressed style also beats hover: .button_primary:hover:not(:disabled) and the focus selector have the same specificity, and the focus rule comes later, so a clicked button still looks pressed while the pointer is over it.

This goes back to the styled-components Button, which applied the pressed style on &:active, &:focus. The CSS Modules setup in #810 narrowed it to focus that isn't :focus-visible and kept the look, as a migration should.

  • Removed the :focus:not(:focus-visible, :disabled) selector from the pressed-style rule of primary, secondary, empty and danger. The pressed style now shows only while the button is held down.
  • Unchanged: the :active style, the :focus-visible ring and fill, and the disabled and loading styles.

Links and tickets

Closes #524

Good to know

  • CSS-only change in Button.module.css (4 selectors removed), no token edits. The existing Button and ButtonGroup tests pass (35).
  • The full pre-PR chain from AGENTS.md passes locally, plus build:health_check.
  • The full Docker visual suite passes (1275 tests) with no snapshot changes.
  • IconButton (:focus, :focus-within) and SplitButton (:focus) have the same pressed-after-click pattern. I think those can go in as separate prs.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets) A clicked Button 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 works as before
  • Vision - no color changes

Tested on Zen Browser v1.24.2b (Firefox-based) on Linux, on the Primary story

Screenshots

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

Before After
before click after click

Keyboard focus is unchanged:

after keyboard


Note

Low Risk
CSS-only interaction styling in Button.module.css; no logic, tokens, or accessibility behavior changes beyond correcting mouse click appearance.

Overview
Mouse-clicked Buttons no longer keep pressed styling after release. For primary, secondary, empty, and danger, the pressed look was tied to both :active and :focus:not(:focus-visible)—so a click left the button focused (without :focus-visible) and stuck in the pressed colors until focus moved. The :focus:not(:focus-visible, :disabled) part of those rules is removed; pressed styling applies only under :active.

:focus-visible styling is unchanged, so keyboard focus still shows the focus ring and active fill. A patch changeset documents the visual fix.

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

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8d8dd1

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

@marsian83
marsian83 marked this pull request as ready for review November 25, 2026 17:36
@XOP
XOP requested review from DreaminDani and XOP November 26, 2026 09:31
@XOP XOP added the bug Something isn't working label Nov 26, 2026
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 672 stories published Open Storybook
UI Tests ✅ 672 tests unchanged Open build

Built from commit: f8d8dd14c673ff3e290ecf6364f5638432e7c5d0 · Chromatic run

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

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

button component feels like it gets "stuck" after clicking

3 participants