-
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
BlockSwitcher: Refactor to use Button layout properly #67502
Conversation
@@ -26,15 +26,6 @@ | |||
} | |||
} | |||
|
|||
.block-editor-block-switcher__toggle-text { | |||
margin-left: $grid-unit-10; |
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.
Unnecessary due to built-in Button styles.
.show-icon-labels & { | ||
display: none; | ||
} |
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.
Moved to JS logic (see showIconLabels
).
@@ -295,12 +291,13 @@ export const BlockSwitcher = ( { clientIds } ) => { | |||
className="block-editor-block-switcher__no-switcher-icon" | |||
title={ blockSwitcherLabel } |
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.
This existing title
implementation can show redundant tooltips not only in showIconLabels
mode, but also for patterns. I will address this separately.
display: none; | ||
} | ||
} | ||
|
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 looks like there are more custom styles that can be removed, but out of scope for this PR.
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. |
Size Change: -31 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
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.
margin-left: $grid-unit-10; | ||
|
||
// Account for double label when show-text-buttons is set. | ||
.show-icon-labels & { |
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 cleanup!
What?
Refactors
BlockSwitcher
to use standard Button features when rendering the icon + text combination.Why?
BlockSwitcher rendered its text label in the
icon
prop, which caused the Button component to not recognize it as a text-containing button (.has-text
). This resulted in a regression when the underlying Button size variant changed in ToolbarButton (#67440).The toolbar button text is overflowing.
How?
Text needs to be either in the
text
prop orchildren
for Button to recognize it as a text-containing use case. The implementation is refactored to this standard pattern.Testing Instructions
Check the BlockSwitcher toolbar button in various use cases:
Screenshots or screencast