-
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 1]. #65034
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. |
@@ -31,8 +31,7 @@ export default function BlockView( { | |||
|
|||
<div className="block-editor-block-compare__action"> | |||
<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.
@@ -24,17 +24,15 @@ export function MultipleUsageWarning( { | |||
<Warning | |||
actions={ [ | |||
<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.
@@ -101,8 +101,7 @@ export default function BlockInvalidWarning( { clientId } ) { | |||
<Warning | |||
actions={ [ | |||
<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.
Hi @mirka , for the |
Mhh, good question! Overriding the For the block breadcrumbs, we could consider setting In both cases, an alternative could also be to use vanilla We should also consider that all I'm not sure if neither of those approaches are better than the CSS |
@vipul0425 , could try to set |
Hi @ciampo For the breadcrumbs it is working fine. However, when I apply that to the block mover buttons and remove the height-specific styles from its stylesheet, the height set by the toolbar component has higher specificity and takes priority. Should we override this in the |
Thanks for working on this! |
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 helping with the button sizing @vipul0425 🙌
Note that some snapshot tests will be failing as a consequence, and you might have to run npm run test:unit:update packages/block-editor/src/components/
to update them and then commit them as part of the PR.
@@ -23,7 +23,6 @@ | |||
} | |||
|
|||
.block-editor-block-breadcrumb__button.components-button { | |||
height: $button-size-small; |
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.
We can potentially remove a lot more style overrides (and the .components-button
classname, which should not be used at all). It also looks like the tertiary
variant is not really needed.
Something like this (click to show diff)
diff --git a/packages/block-editor/src/components/block-breadcrumb/index.js b/packages/block-editor/src/components/block-breadcrumb/index.js
index 865d8d0600..be0ab9fc45 100644
--- a/packages/block-editor/src/components/block-breadcrumb/index.js
+++ b/packages/block-editor/src/components/block-breadcrumb/index.js
@@ -68,7 +68,6 @@ function BlockBreadcrumb( { rootLabelText } ) {
<Button
size="small"
className="block-editor-block-breadcrumb__button"
- variant="tertiary"
onClick={ () => {
// Find the block editor wrapper for the selected block
const blockEditor = blockRef.current?.closest(
diff --git a/packages/block-editor/src/components/block-breadcrumb/style.scss b/packages/block-editor/src/components/block-breadcrumb/style.scss
index a1ae3bf2f1..af56971fe4 100644
--- a/packages/block-editor/src/components/block-breadcrumb/style.scss
+++ b/packages/block-editor/src/components/block-breadcrumb/style.scss
@@ -22,39 +22,11 @@
}
}
-.block-editor-block-breadcrumb__button.components-button {
- line-height: $button-size-small;
- padding: 0;
- position: relative;
-
- &:hover:not(:disabled) {
- text-decoration: underline;
- box-shadow: none;
- }
-
- &:focus {
- box-shadow: none;
- }
-
- &:focus::before {
- content: "";
- display: block;
- position: absolute;
- border-radius: $radius-block-ui;
- top: $border-width;
- right: $border-width;
- bottom: $border-width;
- left: $border-width;
-
- @include button-style__focus();
- }
-}
-
.block-editor-block-breadcrumb__current {
cursor: default;
}
-.block-editor-block-breadcrumb__button.components-button,
+.block-editor-block-breadcrumb__button.block-editor-block-breadcrumb__button,
.block-editor-block-breadcrumb__current {
color: $gray-900;
padding: 0 $grid-unit-10;
Kapture.2024-09-05.at.16.45.51.mp4
What do you folks think? cc @WordPress/gutenberg-design
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.
Cool! I actually looked into it and left a comment since I think we have an opportunity to remove almost every style override there.
Good point. To be honest, the block mover buttons have a lot of custom styles (which, in their turn, override the custom button styles from the toolbar). I'm tempted to leave the style overrides untouched for the scope of this PR, and otherwise consider switching to a vanilla HTML |
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.
Looking good! Thank you for the cleanup work 🙌
Part of - #65018
What?
invalid block warning
,multiple block usage warning
,block compare
,block breadcrumbs
andblock mover
.Why?
To make the consistent button across Gutenberg.
How?
Change from
__next40pxDefaultSize={ false }
to__next40pxDefaultSize
on component.