Repository navigation
Conversation
🦋 Changeset detectedLatest commit: b8d444a 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 |
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,
IconButtonkeeps its pressed colors until focus moves somewhere else, the same bug #1328 fixed forButton.Each type styles
:focusand:focus-withinthe 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.:focusand:focus-withinwith:focus-visiblein the pressed-style rule ofprimary,secondary,ghost,dangerandinfo. The pressed style now shows while the button is held down or focused from the keyboard.:focus-withingoes completely: the only child is the icon<svg>, which can't take focus, so it only ever matched when:focusdid.:activestyle, the:focus-visibleoutline, and the hover and disabled styles.Links and tickets
Follow-up to #1328 (#524).
Good to know
IconButton.module.css(5 rules), no token edits. The existingIconButtontests pass.AGENTS.mdpasses locally, plusbuild:health_check.SplitButton(:focus) is the last one with this pattern; I'll send it separately.Checklist
IconButtonreturns to its normal or hover colors on release; described in the changeset.Contribution
buildandbuild-storybookwork locallyAccessibility
Tested on Chromium on Linux, on the
DangerstoryScreenshots
Click, then move the pointer away (
Danger, dark theme) the red doesn't go away until clicked outside:Keyboard focus is unchanged: