WordPress / gutenberg

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

Featured Image block: Lightbox / Expand use case #57849

Open paaljoachim opened 10 months ago

paaljoachim commented 10 months ago

What problem does this address?

I went ahead and added the Featured Image block to the Single Posts Template.

Screenshot 2024-01-15 at 14 25 06

I made the image so high that it would be possible for people to see the contents and read the words if needed.

If I had made the image small it would not be possible to see the contents or read the words.

What is your proposed solution?

Add "Expand on click" (lightbox) also to the Featured Image block.

Screenshot 2024-01-15 at 14 28 31

So that one can add a smaller image and still making it possible for a user to click the image and see more details of the image.

@artemiomorales

paaljoachim commented 10 months ago

Linking to Tracking issue: https://github.com/WordPress/gutenberg/issues/51132

paulm commented 9 months ago

As a web user, often it's expected that clicking on images in a blog post will open larger. In using Featured Image, it would be highly preferrable to have a native control for enabling this ability, rather than modifying the PHP.

vcanales commented 6 months ago

I see a potential opportunity to rethink the implementation of the Featured Image block entirely. Instead of creating and maintaining a separate logic for the Featured Image block, we could leverage the existing capabilities of the Core Image block.

Proposal

Transform the Featured Image block into a wrapper for the Core Image block. By using the Core Image block as an inner block within the Featured Image block, we can take full advantage of the advanced features and ongoing improvements that the Core Image block offers. This approach minimizes redundant code and maintenance while enhancing the functionality and user experience of the Featured Image block.

Benefits

These thoughts also stem from the fact that in order to implement lightbox on the Featured Image block, a lot of the logic already written for the Image Block would have to be duplicated, or we would have to find a good way to share it.

mikachan commented 6 months ago

This is a high-level comment as I'm not too familiar with the interactivity API or the featured image block 😅

we could leverage the existing capabilities of the Core Image block.

I really like this idea - it makes sense to use the Image block wherever possible to avoid duplicating code/logic. I'm not sure if there are any hidden limitations or reasons why this hasn't been done before.

cc @artemiomorales for any input on this approach to sharing the lightbox logic via using the Image block as any inner block 🙇

desrosj commented 1 month ago

Just wanted to note that I would love this feature. On my site currently, the featured image block for the single posts template is set to full width with cover as the scale. This sometimes results in the image being partially concealed. Having the ability to click on it and view the entire thing would be really nice.

My initial wish was for a switch setting identical to "Link to Post" that just toggled "Expand on Click".

gyurmey2 commented 3 weeks ago

+1