-
Notifications
You must be signed in to change notification settings - Fork 536
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
Add button focus styles #2007
Add button focus styles #2007
Conversation
🦋 Changeset detectedLatest commit: 2f436be 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 |
I am more confused about |
size-limit report 📦
|
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.
The focus style for the primary button doesn't seem to fit with the rest of them. Is this intentional? cc @langermank |
src/Button/styles.ts
Outdated
...fallbackFocus, | ||
'&:focus-visible:not([disabled])': { | ||
outline: '2px solid', | ||
outlineOffset: '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.
@colebemis great catch on the primary style! This code reflects what I've done in PCSS, but I don't think its correct. I can't remember why I didn't negative offset the primary 😅 anyways.. let's try:
outlineOffset: '-2'
boxShadow: 'inset 0 0 0 3px'
That should align better. I'll make that same change in PCSS/dotcom
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.
Ah! I saw the difference in your code too and thought that was the spec. There was no other reference other than what you had done. Thanks for the clarification. :) Will make this change.
@langermank - I think I've to update macos to get to safari 15 |
@colebemis - I'm not sure if the invisible button requires any special treatment. It is smaller in width because it doesn't have border of its own. |
The change makes the
The |
f82477b
to
851a40c
Compare
Safari is weird and you have to go to
@pksjce - you were right, you have to upgrade to Safari 15.4 to test Check out how @langermank and team got consistent cross-browser behavior. |
Hey @mperrotti - It seems to be working fine on Safari now that I've updated it. Screen.Recording.2022-04-07.at.2.35.16.pm.mov |
@pksjce - I still think we need to support Safari <15.4 like Primer CSS does. Do you want me to try to take that on since I still have 14 installed locally? |
54e89a2
to
40b318a
Compare
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.
Tested in Safari 14, and it works the same as Primer CSS 🎉
In anticipation of
Button
s accessibility review, I'm pulling in changes from https://github.com/primer/css/pull/1744/files for button specific focus.My reference is to the focus styles in this storybook.
https://primer-css-eyj5rcc1n-primer.vercel.app/css/storybook?path=/story/patterns-focusstyles--focus-styles
The main change is to remove focus styles of
box-shadow
and substitute it withoutline
.primary
variant of the button gets some special treatment but all others have same focus styles.Before
After
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.