WordPress / gutenberg

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

Lightbox option for gallery block #37652

Open matthiasballreich opened 2 years ago

matthiasballreich commented 2 years ago

It would be very nice to have the Lightbox option for the gallery block. I now i can click on every single image inside the gallery block and enable there the lightbox option, but if i have many images, this ist not the best way. It would be much better to have the lightbox option for the whole gallery block.

lwangdu commented 2 years ago

If there is lightbox option for the gallery block, that would be wonderful. So we don't have to install another plugin, for that reason. Thank you.

paaljoachim commented 1 year ago

That is a very good and helpful idea! @glendaviesnz Glen what are your thoughts around having a lightbox in the Gallery block?

glendaviesnz commented 1 year ago

It has been discussed, but not sure what priority currently is, have added this issue to the gallery improvements project.

paaljoachim commented 1 year ago

@glendaviesnz Glen. Can you add a link to the Gallery Improvements project? Thanks.

masteradhoc commented 1 year ago

+1 for this enhancement

masteradhoc commented 1 year ago

@paaljoachim @glendaviesnz is there any chance this gets a higher priority soon?

paaljoachim commented 1 year ago

I will go ahead and add the "Needs Design" label to it.

rfischmann commented 7 months ago

Now that WordPress 6.4 is out with the native lightbox option for individual images, it doesn't make any sense that it won't work for galleries as well, right?

masteradhoc commented 7 months ago

@paaljoachim is there really a design needed for this?

maybe @artemiomorales or @t-hamano are able to give us an insight how much can be reused from the image component?

paaljoachim commented 7 months ago

Hey @masteradhoc Brian. There is no need for a new design as the Lightbox option has been added to the Image block. I look forward to seeing this also in the Gallery block.

glendaviesnz commented 7 months ago

The Gallery block is essentially just a collection of Image blocks, so I think the main work here would be:

  1. Implement a way to apply the lightbox on setting to all the child images of the gallery. The gallery already does this with the linkto and resolution settings, so shouldn't be too much work
  2. Implement a carousel. I think this would be a basic expectation of users as you don't really want to be opening and closing every image in the gallery, you most likely want to page through them once the lightbox is open
rfischmann commented 7 months ago
2. Implement a carousel. I think this would be a basic expectation of users as you don't really want to be opening and closing every image in the gallery, you most likely want to scroll through them once the lightbox is open

There should be a visible arrow, but also keyboard support for navigation.

t-hamano commented 7 months ago

Regarding this issue, I think it is necessary to consider the inheritance of lightbox.allowEditing and lightbox.enabled attributes.

Even if the Gallery Block's lightbox is controllable and enabled by default, what is the expected behavior if the Image Block's lightbox within it is disabled and is disabled by default?

For example, if theme.json is defined as follows.

{
    "$schema": "https://schemas.wp.org/trunk/theme.json",
    "version": 2,
    "settings": {
        "blocks": {
            "core/gallery": {
                "lightbox": {
                    "allowEditing": true,
                    "enabled": true
                }
            },
            "core/image": {
                "lightbox": {
                    "allowEditing": false,
                    "enabled": false
                }
            }
        }
    }
}

We may also need to consider #54858, which reports that lightbox settings do not work at the root level of theme.json.

firepainting commented 7 months ago

For navigation I agree on having clickable left and right arrows, and keyboard support. As a bonus, is it also possible to make images swipe-able?

This is necessary for galleries with a lot of photos. (Actually we are going to build a site just like that.)

I don't want to rely on plugins just for lightbox. I also don't need fancy ones: just enlarge an image upon click/tap; have the ability to browse the gallery by clickable arrows or swiping; and easily close it when I want. Let's leave fancy for the plugins. WordPress core must be able to do the essentials!

Thank you!

Edit: I acknowledge the "Expand on click" feature which I believe was shipped with WP 6.4.

kauaicreative commented 1 month ago

It would be very nice to have the Lightbox option for the gallery block. I now i can click on every single image inside the gallery block and enable there the lightbox option, but if i have many images, this ist not the best way. It would be much better to have the lightbox option for the whole gallery block.

This issue is related to the, lightbox option for the gallery block. I believe this gallery lightbox toggle was added and then removed. We need to add the option back - a toggle to open all gallery block images in the lightbox without having to click on each image individually. Or perhaps better yet, the option to select multiple images and be able to select link > open in lightbox