-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent .show-on-focus
to change width/height
#2391
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 |
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
margin: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed margin
so negative margin can be used for positioning.
padding: 0 !important; | ||
overflow: hidden !important; | ||
clip: rect(1px, 1px, 1px, 1px) !important; | ||
border: 0 !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added padding
+ border
since they can increase the size of an element.
What are you trying to accomplish?
This came up in Slack. Currently the
.show-on-focus
utility sets the width/height toauto
when focused. This is fine for most elements but causes the new.Button--iconOnly
to loose its fixed width/height.What approach did you choose and why?
This PR...
:not(:focus)
selector. This makes sure that the:focus
selector doesn't need to set the width/height toauto
.!important
to override longer selectors and other utilties..show-on-focus
on 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?