-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Item: Unify focus style and add default font styles #52495
Changes from 4 commits
48a9691
ebe07be
821a377
1194265
5e88060
48b6050
672e399
74cdb6b
9e29aab
51ef2f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,32 +8,35 @@ import { css } from '@emotion/react'; | |
*/ | ||
import { CONFIG, COLORS } from '../utils'; | ||
|
||
export const unstyledButton = css` | ||
appearance: none; | ||
border: 1px solid transparent; | ||
cursor: pointer; | ||
background: none; | ||
text-align: start; | ||
|
||
svg, | ||
path { | ||
fill: currentColor; | ||
} | ||
|
||
&:hover { | ||
color: ${ COLORS.ui.theme }; | ||
} | ||
|
||
&:focus-visible { | ||
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) | ||
var( | ||
--wp-components-color-accent, | ||
var( --wp-admin-theme-color, ${ COLORS.ui.theme } ) | ||
); | ||
// Windows high contrast mode. | ||
outline: 2px solid transparent; | ||
} | ||
`; | ||
export const unstyledButton = ( as: 'a' | 'button' ) => { | ||
return css` | ||
appearance: none; | ||
border: 1px solid transparent; | ||
cursor: pointer; | ||
background: none; | ||
text-align: start; | ||
text-decoration: ${ as === 'a' ? 'none' : undefined }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a style that cancels the default underline only for the anchor element. |
||
|
||
svg, | ||
path { | ||
fill: currentColor; | ||
} | ||
|
||
&:hover { | ||
color: ${ COLORS.ui.theme }; | ||
} | ||
|
||
&:focus-visible { | ||
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) | ||
var( | ||
--wp-components-color-accent, | ||
var( --wp-admin-theme-color, ${ COLORS.ui.theme } ) | ||
); | ||
// Windows high contrast mode. | ||
outline: 2px solid transparent; | ||
} | ||
`; | ||
}; | ||
|
||
export const itemWrapper = css` | ||
width: 100%; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,6 @@ | |
fill: $gray-700; | ||
} | ||
|
||
&:is(a) { | ||
text-decoration: none; | ||
display: flex; | ||
align-items: center; | ||
|
||
&:focus { | ||
box-shadow: none; | ||
outline: none; | ||
} | ||
Comment on lines
-34
to
-37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
&.with-suffix { | ||
padding-right: $grid-unit-20; | ||
} | ||
|
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.
Should we also add an explicit font-size to normalize the sizes between button and anchor? (Like this)
In Storybook we can see the font sizes will be different due to the user agent styles.
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.
Please see: #52495 (comment)