Skip to content
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

Merged
merged 11 commits into from
Sep 24, 2024

Conversation

vipul0425
Copy link
Contributor

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.

Copy link

github-actions bot commented Sep 11, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: vipul0425 <vipulgupta003@git.wordpress.org>
Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variation-skip-button-before

  • __next40pxDefaultSize has no effect here because the variation is set to link for this button, which overrides the size with height: auto.

@@ -35,8 +35,7 @@ function VariationsButtons( {
</VisuallyHidden>
{ variations.map( ( variation ) => (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
block-variation-transform-before block-variation-transform-after

Copy link
Contributor

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).

Copy link
Contributor

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?

Copy link
Contributor

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I have updated it to use compact size.

@@ -60,8 +60,7 @@ function ButtonBlockAppender(

return (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
button-block-appender-before button-block-appender-after

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The + icon looks too small. flex-shrink: 0 should fix but there might be a better way?

Related, the empty placeholder that appears adjacent in a Row/Stack has a 46px min-height which causes a mis-match:

Screenshot 2024-09-12 at 16 08 43

It might be good to update that here.

Copy link
Contributor Author

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.

image

__next40pxDefaultSize={ false }
{ ...toggleProps }
>
<Button __next40pxDefaultSize { ...toggleProps }>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already taking 40px in height before, so there's no change after setting it to true.

color-panel-button-before-after

__next40pxDefaultSize={ false }
{ ...toggleProps }
>
<Button __next40pxDefaultSize { ...toggleProps }>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already taking 40px in height before, so there's no change after setting it to true.

color-panel-button-before-after

@@ -190,8 +190,7 @@ export default function FiltersPanel( {
return (
<ItemGroup isBordered isSeparated>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
filters-button-before filters-button-after

__next40pxDefaultSize={ false }
{ ...toggleProps }
>
<Button __next40pxDefaultSize { ...toggleProps }>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
shadow-toggle-button-before shadow-toggle-button-after

@@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
shadow-indicator-before shadow-indicator-after

It looks a bit stretched to me after setting it to 40px. I tried using the small size, but then it appeared a bit too shrunken. Let me know if any adjustments are needed.

Copy link
Contributor

@DaniGuardiola DaniGuardiola Sep 11, 2024

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.

Copy link
Contributor

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)

Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Member

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.

Copy link
Contributor

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

Copy link
Contributor Author

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. 🙇

Copy link
Contributor

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 👍

Copy link
Member

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
shadow-clear-button-before shadow-clear-button-after

@tyxla tyxla requested a review from a team September 11, 2024 13:41
@tyxla tyxla added the [Type] Code Quality Issues or PRs that relate to code quality label Sep 11, 2024
Copy link
Contributor

@DaniGuardiola DaniGuardiola left a 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.

Copy link
Member

@mirka mirka left a 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 👍

packages/block-library/src/group/editor.scss Outdated Show resolved Hide resolved
packages/block-library/src/group/editor.scss Outdated Show resolved Hide resolved
Co-authored-by: Lena Morita <lena@jaguchi.com>
Copy link
Member

@mirka mirka left a 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!

@mirka mirka merged commit df5eaed into WordPress:trunk Sep 24, 2024
63 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.4 milestone Sep 24, 2024
@mirka mirka added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 1, 2024
@noisysocks
Copy link
Member

noisysocks commented Oct 6, 2024

When I try to cherry-pick df5eaed onto wp/6.7 I get an empty commit. I suppose it was already backported? Just double check that please and if everything's okay remove the label.

noisysocks pushed a commit that referenced this pull request Oct 6, 2024
…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 <lena@jaguchi.com>

* Update packages/block-library/src/group/editor.scss

Co-authored-by: Lena Morita <lena@jaguchi.com>

* feat: Add tootlip tu shadow button.

---------

Co-authored-by: vipul0425 <vipulgupta003@git.wordpress.org>
Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
@mirka
Copy link
Member

mirka commented Oct 7, 2024

@noisysocks I'm confused, it looks like you already backported it for us in 53b4edf ?

@kevin940726 kevin940726 added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants