Repository navigation
Conversation
🤖 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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +168 B (0%) Total Size: 9.06 MB 📦 View Changed
⚡ 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. Regression: updating a specific option will only change its value and will not corrupt others in
|
|
If the caption contains a link does that mean it no longer receives the cursor pointer on hover? Not all themes display the caption as an overlay, is there anyway to only apply this in themes that do? |
7e89676 to
5efd7af
Compare
|
Good notes. I had a think and landed on this:
When captions are outside, it's just like old times. When captions are overlaid and the gallery image is lightboxed, they are now entirely non-interactive. The argument: we have to land #81500 as well, which provides the more accessible and legible way to read long overlay captions anyway: under the image, large, with space. What do you think? |
A gallery caption is laid over the bottom of its image and may grow to cover it entirely. With "Enlarge on click" the lightbox opens from a click on the `img`, so a caption that covered the image took every one of those clicks and left no way to open it. The only way in was the Enlarge button, which is invisible until the image is hovered, and so absent on touch. Let the whole caption click through to the image, as the blur scrim over it already does. The tile becomes one surface carrying the zoom cursor throughout, and the caption is read in the lightbox, where it is legible and selectable, rather than four lines at a time in a thumbnail. This takes in any link the caption holds: `pointer-events` is inherited, so a link stops being clickable here too, which keeps one cursor and one behaviour across the whole image. The rounded and bordered styles put the caption under the image rather than over it, where it covers nothing and there is nothing to click through to, so they are excluded and keep their captions scrollable and selectable. `wp-lightbox-container` is added when the block is rendered, so captions in the editor, and in galleries without the lightbox, are untouched as well. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5efd7af to
1751959
Compare

What?
While working on #81500, I discovered what is arguably a bug: if you set images in a gallery to open in a lightbox, any captions you put on the gallery images block a click to open. Clicking the text just shows the text caret.
This PR applies pointer-events: none; to just the caption, and only when the image is using "Expand on click":
Why?
Choosing "Expand on click" is a choice to make your gallery interactive, so it should be trivial to open thumbnail images, even when they have caption overlays.
The pointer-events issue does mean that if your overlay caption is long enough to scroll, you can't scroll it inside the thumbnail. That's the primary tradeoff, but this still works if you toggle off expand on click. And if/when we land #81500, the story is much clearer: if you want to read the caption, simply click the thumbnail to see the caption LARGE and legible below the full image in the lightbox, rather than as a tiny bit of overlay text.
Test
Create a gallery, set all images to expand on click, add LONG captions to at least one of the images, then click around in a preview.
Use of AI Tools
Claude Opus 5.