Prevent .show-on-focus to change width/height#2391
Merged
Conversation
🦋 Changeset detectedLatest commit: 0629fd0 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 |
simurai
commented
Feb 27, 2023
| position: absolute; | ||
| width: 1px; | ||
| height: 1px; | ||
| margin: 0; |
Contributor
Author
There was a problem hiding this comment.
I removed margin so negative margin can be used for positioning.
simurai
commented
Feb 27, 2023
| padding: 0 !important; | ||
| overflow: hidden !important; | ||
| clip: rect(1px, 1px, 1px, 1px) !important; | ||
| border: 0 !important; |
Contributor
Author
There was a problem hiding this comment.
Added padding + border since they can increase the size of an element.
langermank
approved these changes
Feb 27, 2023
Merged
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.
What are you trying to accomplish?
This came up in Slack. Currently the
.show-on-focusutility sets the width/height toautowhen focused. This is fine for most elements but causes the new.Button--iconOnlyto loose its fixed width/height.What approach did you choose and why?
This PR...
:not(:focus)selector. This makes sure that the:focusselector doesn't need to set the width/height toauto.!importantto override longer selectors and other utilties..show-on-focuson https://primer.style/design/foundations/css-utilities/layout.Screen.Recording.2023-02-27.at.21.15.18.mov
What should reviewers focus on?
Any alternatives? Was thinking we could also use a wrapper element that is shown with
:focus-within. But adding a wrapper element makes things more complex and could mess up things like flexbox or so.Can these changes ship as is?