-
Notifications
You must be signed in to change notification settings - Fork 4.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
Fix: Button Replace remaining 40px default size violations [Block Editor 3] #65225
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -64,8 +64,7 @@ function BlockVariationPicker( { | |||
{ allowSkip && ( | |||
<div className="block-editor-block-variation-picker__skip"> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
@@ -35,8 +35,7 @@ function VariationsButtons( { | |||
</VisuallyHidden> | |||
{ variations.map( ( variation ) => ( | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
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'm not sure about this one. I think it should be more like ToggleGroupControl. IE the outer container is 40px
, while the inner buttons are 32px
(compact
size).
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.
@jameskoster what about just using a ToggleGroupControl?
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 visible stroke in the resting state would create additional weight that is probably unwanted in this UI.
We have an issue to explore the ToggleGroupControl
design here, which might make it appropriate for use in its vanilla state if implemented.
But until then the simpler approach is probably to just make these buttons compact
(32px).
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.
@@ -60,8 +60,7 @@ function ButtonBlockAppender( | |||
|
|||
return ( | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
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.
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.
Hi @jameskoster, I have removed the styles that were overriding the component button padding to fix the small icons. Also fixed the empty placeholder height.
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> |
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.
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> |
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.
@@ -190,8 +190,7 @@ export default function FiltersPanel( { | |||
return ( | |||
<ItemGroup isBordered isSeparated> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
__next40pxDefaultSize={ false } | ||
{ ...toggleProps } | ||
> | ||
<Button __next40pxDefaultSize { ...toggleProps }> |
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.
@@ -89,8 +88,7 @@ export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) { | |||
} ) } | |||
render={ | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
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.
@WordPress/gutenberg-design ?
Seems to me like we just want normal <button>
s (with the original size) here, not sure why use Button
if these are fully custom.
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.
It seems that the Shadow Palette has used the Button
component since it was first implemented: https://github.com/WordPress/gutenberg/pull/46502/files#diff-d3db145a5a2d621586d0b1740cc8b403e58afac79bfe418bf7752fa3af88dc2bR164-R171
I don't know why the Button
component was used, but based on this comment, it seems that we were trying to imitate the style of the color palette (CircularOptionPicker.Option
component).
In fact, the CircularOptionPicker.Option
component is also implemented internally as a Button
component and is fully customized (source)
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.
For this PR it's probably best to keep those buttons visually looking the same as before, regardless of what component is used. A button
element rather than the component may be a fine solution there.
Longer term, we should find a better design for these that's clearer.
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.
It would be good to avoid the arbitrary 26px
sizing and use of the more standardised options (24
, 32
, or 40
).
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 also noticed that wrapping the button
with a Tooltip
breaks the Composite
's keyboard navigation, so we need to wrap the entire Composite.Item
with the Tooltip
.
☝️ @ciampo Did you know about this quirk? Not immediately sure why that is. The Tooltip
embedded in a Button
component doesn't break Composite.
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.
No, I wasn't aware. Maybe we should open a separate issue to at least track this quirk
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.
Hi @t-hamano I have updated <button>
as per your suggestion. Let me know if anything else needs to be updated. 🙇
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.
Thanks for the update. I think it perfectly maintains its functionality and style 👍
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.
Documented the Composite + Tooltip issue at #65615.
@@ -42,8 +42,7 @@ export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) { | |||
/> | |||
<div className="block-editor-global-styles__clear-shadow"> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
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.
LGTM except for the shadow buttons, see https://github.com/WordPress/gutenberg/pull/65225/files#r1755854718
Let's wait for design feedback.
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 had one small nit, but everything else looks good now 👍
Co-authored-by: Lena Morita <[email protected]>
Co-authored-by: Lena Morita <[email protected]>
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.
Looks great, thank you for the follow-ups!
When I try to cherry-pick df5eaed onto |
…tor 3] (#65225) * Fix: Global Styles component to use 40px default size. * Fix: Block variation picket to use 40px default size. * Fix: Block variation transform to use 40px default size. * Fix: color gradient dropdown and block appender button to use 40px default size. * fix: shadowpanel clear button * fix: Button Block appender issues. * fix: Coverts shadow panel Buttons to normal html buttons. * Update packages/block-library/src/group/editor.scss Co-authored-by: Lena Morita <[email protected]> * Update packages/block-library/src/group/editor.scss Co-authored-by: Lena Morita <[email protected]> * feat: Add tootlip tu shadow button. --------- Co-authored-by: vipul0425 <[email protected]> Co-authored-by: DaniGuardiola <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: jasmussen <[email protected]> Co-authored-by: jameskoster <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]>
@noisysocks I'm confused, it looks like you already backported it for us in 53b4edf ? |
Part of - #65018
What?
This would fix in that in subtask
block-editor-3
.Why?
To make the consistent button across Gutenberg, and we would have a lint rule added once fixed, all the button usage.
How?
Change from
__next40pxDefaultSize={ false }
to__next40pxDefaultSize
on component.Testing Instructions
Testing steps and screenshots are added below.