-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block toolbar: Add tranform to Gallery button when selecting multiple image blocks #58418
base: trunk
Are you sure you want to change the base?
Block toolbar: Add tranform to Gallery button when selecting multiple image blocks #58418
Conversation
Size Change: +415 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in 5398748. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7705864969
|
Thanks for taking this for a spin @ramonjd! I've just added design as reviewers. Let's see what folks think, if it's a useful addition 🙂 |
Thanks for the PR! I'm actually conflicted by this one. On the one hand, it feels an obvious shortcut that is contextual to selecting multiple images. On the other hand, there's a transforms menu dedicated to this, which has gone mostly unloved for a while, and really could use a revisit before we add all the more buttons in the toolbar. I'd love to hear from others, whether there are any strong opinions one way or the other. |
Thank you Andrew for this nice enhancement! Now we just need it the way around as well (opposite direction). Selecting multiple images in a Gallery block and having an icon in the same location to break up Gallery block images into individual Image block images. |
Ahh yes. Joen brings up a good point. The Transform menu. It dropped into my mind as I was testing. |
I agree. In progress of writing this comment I found this discussion again, where I propose defining clear sections for the toolbar: #56385 (comment) Regarding this PR: I think for now it's fine to add the gallery, as it only possible to do so only when multiple images are selected. However, it could get messy when spacers would be allowed in the gallery, like proposed here in #52171 |
Thanks for the feedback, folks! I'll leave this PR open for now and see what other kind of feedback we might get — it's definitely not an urgent one.
Good points about the transform menu! I don't feel too strongly one way or the other — my main observation when selecting multiple images is that personally I'm more likely to want to reach for a Gallery block than Group/Row/Stack. But very happy to let this PR simmer until there's been a chance to take a look at the transform menu, if folks prefer 🙂
Good point — at the moment this PR checks to see if there's an available transform to a Gallery block based on the currently selected blocks. If spacers are allowed in a Group block, I don't think it'd automatically add a transform to a Gallery block, so (in theory) with this PR applied, if a user were to select a bunch of blocks that contained images and spacers, the Gallery button wouldn't be shown. If and when Spacer support is added, we could look at the logic here and decide whether or not the presence of a Spacer should enable the ability to transform to a Gallery or not. |
Yeah it would be nice if all these toolbar actions we've accumulated (Row, Stack, Group, Convert to blocks) were more attached to the transforms menu. That way we're teaching users about the transforms menu which is a good tool to have in the kit. That said this looks useful. I'd support adding it until we revisit the transforms menu. |
After a review from the core editor triage and tech leads, this has been punted from the release. Can we merge this for a future release beyond 17.7 for GB as a result (if it's merged at all)? Seems we aren't clear on this UX and what the desired outcome is so I'd rather we proceed carefully considering the lack of time to get feedback in ahead of something going in beta 1. |
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 Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf 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. |
Absolutely, thanks for the update @annezazu — this feature didn't cross the threshold for anyone feeling strongly enough about its inclusion for it to make it for WP 6.5, but I think it's an interesting one to potentially try in the plugin — or, alternately, happy to close it out to defer to future work on transform menus. |
What?
When a multi-selection contains only image blocks, expose a button in the block toolbar to quickly convert to the Gallery block.
Based on an idea from @tellthemachines while looking at the transforms in #57749
Note
This is a fairly prominent button — I'm happy to close out this PR if it isn't desired behaviour
Why?
Make it easier for folks to select image blocks and convert to a gallery. The assumption here is that if folks are selecting multiple image blocks, and no other blocks, converting to a gallery will be a common task, so it should be a bit more prominent.
How?
In the convert to group logic, add an additional toolbar item for converting to a Gallery block, exposed only if the transform "to" a Gallery block is available given the current block selection (i.e. the selection is only image blocks).
Testing Instructions
wp.blocks.unregisterBlockType( 'core/gallery' );
— after calling that, go to select multiple image blocks. The Gallery button should no longer be available.Screenshots or screencast
2024-01-30.13.13.36.mp4