WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
9.99k stars 4.02k forks source link

Lightbox: caption missing when opening lightbox image #60469

Open mamaretti opened 3 months ago

mamaretti commented 3 months ago

Description

hello

since #58835 figcaption is missing on opened lightbox image

(WP 6.5)

Step-by-step reproduction instructions

add an image with caption and trigger lightbox link

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

annezazu commented 2 months ago

@artemiomorales can you look into this?

annezazu commented 2 months ago

Pulling in feedback and a question from a separate issue:

I am the developer of an image caption plugin for publishers who need to show image attributions for legal reasons. With WordPress 6.5, lightboxes no longer show the caption I added to images in the post content since lightbox HTML is not rendered separately.

Ideally, I could add a placeholder for the caption into block_core_image_print_lightbox_overlay() using a filter, but there is none. Would you be able to provide one?

In a next step, I would need to figure out how to fill it, but the render_block_core/image filter might just be good for that.

artemiomorales commented 2 months ago

@annezazu Thanks for the ping! I'm not sure I have bandwidth to look at this for the upcoming release. To clarify @webzunft, do you need to render the caption inside the lightbox overlay itself? And this was working prior to 6.5?

webzunft commented 2 months ago

@artemiomorales

do you need to render the caption inside the lightbox overlay itself? And this was working prior to 6.5?

Yes and yes. In 6.4, I just had to place my caption markup close to the image and it was showing up with it in the lightbox.

gziolo commented 1 month ago

It might be related to this refactoring that uses a shared HTML for all Lightbox overlays: