Repository navigation
Gallery: Share figure and caption between static and dynamic modes - #86787
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the ⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
|
@andrewserong, @ramonjd, I promise, I only have one refactoring PR left on the list 😄 |
andrewserong
left a comment
There was a problem hiding this comment.
Very cool, I didn't notice that the dynamic gallery could so easily re-use the static version's Gallery component. Nicely done!
Smoke tested adding and removing captions on the static and dynamic blocks, and all the different styling states for the dynamic variation (number of columns, wide/full layouts, cropping images, etc)
Looking good 🚀
…ordPress#86787) Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
What?
Follow up to #86768.
Static and dynamic galleries now both render through
Galleryingallery.jsx, which builds the<figure>classes and caption once. No user-visible change.Why?
The
<figure>classes (blocks-gallery-grid, align,columns-*,is-cropped, layout classes) and the caption were built twice, ingallery.jsxand in the dynamic branch ofedit.jsxandGalleryDynamicView, so a change to one mode could miss the other.edit.jsxdrops from 579 to 562 lines.How?
Gallerytakes the inner blocks or the dynamic preview aschildren, and the classes stay there rather than inuseBlockPropsso the empty-gallery placeholder doesn't get them. TheisContentLockedprop is removed: block edit components haven't received it since #50643, so it was always undefined.Testing Instructions
Testing Instructions for Keyboard
Same as above.
Use of AI Tools
Assisted by Claude.