-
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
Grid Interactivity: Fix block mover layout and styles #64021
Conversation
if ( | ||
! canMove || | ||
( isFirst && isLast && ! rootClientId ) || | ||
( hideDragHandle && isManualGrid ) | ||
) { |
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.
Prevents a ToolbarGroup
component that has no children from being rendered.
); | ||
} } | ||
/> | ||
<div className="block-editor-grid-item-mover__move-horizontal-button-container is-left"> |
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 the toolbar button, the ::before
pseudo-element is used for the focus outline and the :::after
pseudo-element is used for the text when "Show button text labels" is enabled.
I wrapped the button in a div
to render a border as a pseudo-element.
@@ -105,7 +105,6 @@ | |||
.block-editor-grid-item-mover-button { | |||
width: $block-toolbar-height * 0.5; | |||
min-width: 0 !important; // overrides default button width. | |||
overflow: hidden; |
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.
.editor-collapsible-block-toolbar { | ||
.block-editor-grid-item-mover__move-vertical-button-container { | ||
// Move up a little to prevent the toolbar shift when focus is on the vertical movers. | ||
@include break-small() { | ||
height: $grid-unit-50; | ||
position: relative; | ||
top: -5px; // Should be -4px, but that causes scrolling when focus lands on the movers, in a 60px header. | ||
} | ||
} | ||
} |
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.
Similar to this approach for the default block mover. the .editor-collapsible-block-toolbar
selector is used to determine that the Top Toolbar is enabled.
@@ -208,5 +242,21 @@ | |||
} | |||
} | |||
|
|||
.block-editor-grid-item-mover-button { | |||
white-space: nowrap; |
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.
Size Change: +251 B (+0.01%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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. |
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 works great! Thanks for the attention to detail and excellent PR description / inline comments.
I recently tidied up the list of tasks in #57478 if you'd like to keep working on Grid 😀 |
Thanks for the review!
I'll try to find a task that I can tackle 👍 |
Fixes #64017
What?
This PR fixes the block movers layout and style when the experimental "Grid interactivity" setting is enabled and a grid block is in manual mode,
Why?
The core mover buttons determine their layout and style taking into account scenarios such as browser width, whether Top Toolbar is enabled, whether "Show button text labels" is enabled, etc. I believe similar logic is needed for the mover buttons for grid blocks.
How?
I applied the same logic as the core mover button, details are commented inline.
Testing Instructions
We need to test the following scenarios:
For each of these scenarios, make sure that:
Screenshots or screencast
Before
before.mp4
After
after.mp4