Gallery and Image Lightbox improvements

Hi devs,

I believe that we have the following issues that we could improve:

  1. When using the gallery macro, you can either click on the fullscreen button or hover over the current image and click the fullscreen button for the lightbox feature. The 2 features are very close but confusing. There’s also a problem if you click on the lightbox fullscreen but: it only shows the first image of the gallery macro and not the current image, and you cannot cycle through the images.

  2. Similary when in gallery fullscreen mode, you can also hover and click on the lightbox fullscreen button. This is also confusing.

  3. The gallery macro currently doesn’t support displaying captions. See Loading...

Proposals:

  1. Make the gallery macro depend on lightbox feature for its fullscreen button and when clicked, use the lightbox fullscreen feature. 2 sub ideas:

    • If we don’t want to have the gallery macro depend on the lightbox feature, then we’d need to have both gallery and lightbox depend on the same code.
    • The lightbox will display all images found on the current page. We would probably need to be able to restrain it to a list to have the same behavior as the gallery macro currently has (to only display images defined inside it).
  2. If we implement 1) then 2) becomes moot (since the lightbox fullscreen will not display actions on hover)

  3. The lightbox feature already supports captions so all we would have to do is have the gallery macro not remove the captions and “pass” them to the lightbox feature.

  • Optional: we could also decide to display the captions in the gallery view, even when the images are not in full screen but there’s a lot less spacen so I’m not sure it’s a good idea.

WDYT?

I’m curious especially to get feedback from @mflorea and @Oana-Lavinia_Florean who coded the Gallery macro and the Lightbox feature.

Thx

I think the simplest (and what we should have done from the start) is to disable the lightbox for the gallery images using the dedicated CSS class.

On the long run, we need to improve the gallery macro for sure. We should probably also consider integrating / reusing a library instead of our own code. If we continue with the current code then it makes sense to integrate with the lightbox for the full screen mode. I don’t see a problem with making the gallery macro depend on the lightbox or on a common module that allows opening a lightbox for a given set of images.

Thanks,
Marius

I was trying to discuss the next step but I agree that we should do this now. I’ve created Loading... for it.