-
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
Make parent block selector visible and offset the toolbar. #28598
Conversation
Size Change: -28 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
a6cc643
to
da52974
Compare
We've tried many things: the parent pop-out chip, clickthrough, breadcrumbs, the block traversal tool. Some are still around, others were not succesful. Because it's such an important tool, it's important to continue refining this interface. And this feels like a natural evolution of the parent pop-out chip, probably why it's already been proposed and discussed. The benefits remain:
Downsides remain:
However, since the original conversations, a few changes have been made which makes me think it's time to try it:
And in practice this change really does improve things. Notably the hover block boundary indication is highly helpful in indicating the behavior. Cover: A paragraph inside a default group (fixes #20453): Columns benefit vastly: Navigation benefits: I think there's still there's work to do separately. Notably the width of the block mover/drag control adds weight to child block toolbars, and in that the option doesn't work with the "top toolbar" option, it seems like there might be an opportunity to explore a solution that tackles both. Finally, blocks with already wide toolbars, such as List, will either need nesting (to split the long toolbar into parent and child) or other thought (group tools in dropdowns). But all of those followups are general benefits to the block UI, and ultimately the benefits of this approach seem worth trying. The "Group" block example above feels like a good litmus test: before it was unobvious that the paragraph was inside an invisible group, but with the added chip, its place in the hierarchy becomes immediately obvious, and will benefit both Quote and Gallery blocks as they get nesting. 🚀 |
fdd33c9
to
fb83d1e
Compare
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.
Nice one.
packages/block-editor/src/components/block-list/block-contextual-toolbar.js
Outdated
Show resolved
Hide resolved
> | ||
<ToolbarButton | ||
className="block-editor-block-parent-selector__button" | ||
onClick={ () => selectBlock( firstParentClientId ) } | ||
label={ sprintf( | ||
/* translators: %s: Name of the block's parent. */ | ||
__( 'Select parent (%s)' ), | ||
__( 'Select %s' ), |
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.
In #26135 this change was also proposed, but I don't think it's a good idea for situations where a block might be nested in same block type - e.g. a group within a group. That seems very confusing, I think it's probably quite confusing already with the icon being the same as the block icon.
Are there other options? I proposed just making it 'Select parent'. Alternatively could the text wrap in the text labels mode?
cc @tellthemachines.
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 think the same block nested within itself is enough of a special case that we might just as well treat that one separately. "Select parent" is rather technical and cumbersome for most cases (for example, selecting the Gallery that contains an Image, or the Quote that has a paragraph, etc). I think all of these cases benefit from a more straightforward phrasing.
Co-authored-by: Miguel Fonseca <[email protected]>
a92eced
to
b447787
Compare
🔥 |
I'm guessing this change wasn't tested with text labels enabled: Text labels have variable widths, so fixing this will require removing the absolute positioning on the parent button, which also means we'll have to set the background and borders on the toolbar elements instead of the parent, to keep that little separation between parent button and the rest of the toolbar. |
Sorry about that one, I'll try and follow with a PR. |
Fix in #28721. |
Oh my, I was convinced we had not yet applied the text only treatment to the contextual block toolbar. |
I made sure to get it in for 5.7, as it felt weird to just have text labels in the top toolbar 😄 Thanks for the quick fix @jasmussen ! |
Closes #28522.
Complements #23800.
Parent highlighting outline:
Current block highlighting outline: