Repository navigation
Conversation
🦋 Changeset detectedLatest commit: fa4d72d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After a mouse click,
Buttonkeeps 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-visibleand kept the look, as a migration should.:focus:not(:focus-visible, :disabled)selector from the pressed-style rule ofprimary,secondary,emptyanddanger. The pressed style now shows only while the button is held down.:activestyle, the:focus-visiblering and fill, and the disabled and loading styles.Links and tickets
Closes #524
Good to know
Button.module.css(4 selectors removed), no token edits. The existingButtonandButtonGrouptests pass (35).AGENTS.mdpasses locally, plusbuild:health_check.IconButton(:focus,:focus-within) andSplitButton(:focus) have the same pressed-after-click pattern. I think those can go in as separate prs.Checklist
Buttonreturns to its normal or hover colors on release; described in the changeset.Contribution
buildandbuild-storybookwork locallyAccessibility
Tested on Zen Browser v1.24.2b (Firefox-based) on Linux, on the
PrimarystoryScreenshots
Click, then move the pointer away (
Primary, dark theme) the dark color doesn't go away until clicked outside:Keyboard focus is unchanged:
Note
Low Risk
CSS-only selector tweak in
Button.module.csswith no JS or token changes; keyboard:focus-visiblebehavior is preserved.Overview
Fixes a visual bug where
Buttonstayed in its pressed (active) colors after a mouse click until focus moved elsewhere (#524).For primary, secondary, empty, and danger variants in
Button.module.css, the pressed styling rule no longer includes:focus:not(:focus-visible, :disabled)—only:active:not(:disabled)applies the active colors. Mouse clicks still focus the button, but without:focus-visiblethat focus no longer keeps the pressed look after release; hover returns as expected.:focus-visiblekeyboard focus rings and fills are unchanged. A patch changeset documents the visual behavior update.Reviewed by Cursor Bugbot for commit fa4d72d. Bugbot is set up for automated code reviews on this repo. Configure here.