Image: Include the Add toolbar button from the Gallery block when nested within a Gallery - #81469
Image: Include the Add toolbar button from the Gallery block when nested within a Gallery#81469andrewserong wants to merge 2 commits into
Conversation
|
Size Change: +234 B (0%) Total Size: 7.71 MB 📦 View Changed
|
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @aisajib, @mikeicode. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
Thanks for taking a look @jasmussen! Let's see what others think, too.
I should have mentioned in the PR description, this looks like a bigger code change than it is. Most of the code remains the same, just moved into a shared hook and component (so it can be shared with the Image block), but it should otherwise be functionally identical. I think this makes things a little neater for the Gallery block. |
|
I haven't run the PR because the video attached shows it clearly. The change is simple and adds value, so thumbs up to the change. Regarding the toolbar, I agree with Joen about the refactor. We have talked in other tickets about the needs and opportunities the toolbar has. |


What?
Fixes #47200
Share and "Add" toolbar button between the Gallery block and Image blocks that are nested within a Gallery block. That is, expose the gallery block's Add control to the child image block.
Why?
As described in #47200 it can be hard to find where to add images to a gallery block just by selecting the gallery block as a first click onto an image within the gallery.
So, this PR tries a fairly naive approach of sharing the control between the image and gallery blocks. It intentionally doesn't use the
"__experimentalExposeControlsToChildren"support because:There's discussion elsewhere e.g. in #61209 (comment) for other options of exposing parent/child controls, but IMO I think Gallery -> Image might be kind of unique in this respect as it's just about exposing "Add" for now. That said, open to ideas here!
How?
AddImagesToolbarControlcomponentAddImagesToolbarControlright next to the Replace control when the image is a child of a Gallery blockTesting Instructions
Screenshots or screencast
A quick video showing "Add" working at both the Image and Gallery block levels:
2026-08-12.15.55.27.mp4
Use of AI Tools
Claude Code Opus 5 to develop the change, and I've been reviewing and testing as I go