- Issue created by @heatherwoz
- π·πΈSerbia levmyshkin Novi Sad, Serbia
Hi heatherwoz, I checked Responsive image with Content Type > Media (multiple values) > Image field and description is working:
But you are right, I cloned Colorbox module and moved 'data-gbox-img-attributes' instead of 'data-cbox-img-attributes' from Colorbox:
GLightbox uses data-glightbox attribute with 'title' and 'description' values:
https://github.com/biati-digital/glightbox?tab=readme-ov-file#examples
I need to know your struction of content type, images can be in different nested entity types, for example:
Content type > Paragraph field > Media > Image
Content type > Paragraph field (gallery) > Pagraph field (gallery item) > Media > Image
Content type > Paragraph field > Image
Content type > Paragraph field (gallery) > Pagraph field (gallery item) > ImageIt's impossible to predict all possible structures and nested levels for images, so I fetched few most common structures for captions.
https://www.drupal.org/project/glightbox/issues/3487478 π Allow caption tokens from parent (paragraph entity) Active
https://www.drupal.org/project/glightbox/issues/3511270 π Allow caption tokens paragraph access if there is a parent paragraph Active
https://www.drupal.org/project/glightbox/issues/3492657 π Create a service for caption calculation ActiveIf you describe your structure, I will add your case as well.
- πΊπΈUnited States heatherwoz Seattle
Thanks for your reply.
The caption and description are working. It is the `alt` attribute on the `img` tag that is missing. I expect it to be there for accessibility. Someone could create a light box that does not include captions or descriptions, and assistive technology would need alt text to describe the image.
Our particular case is Custom Block > Media > Image.
- π¦π½Γ land Islands albertho425 Seattle, WA
I am also experiencing the issue where ALT text is not displaying for an image that has ALT text. In my use case, I am using it in Drupal 10 Gutenberg editor for core and custom Gutenberg blocks.
I tried adding glightbox via contrib module and installing glightbox manually via my custom Gutenberg blocks library. No ALT text for images that have ALT text.
-
levmyshkin β
committed f11907d0 on 1.0.x
Issue #3532876 by heatherwoz, levmyshkin: Alt text missing on lightbox...
-
levmyshkin β
committed f11907d0 on 1.0.x
- π·πΈSerbia levmyshkin Novi Sad, Serbia
Hi heatherwoz, albertho425, I added data-alt attribute in links with text from Caption. I'm not sure if you need additional separate field for alt attribute. Usually it should be enough to have something meaningful in alt="" attribute. And I removed aria-label from tag, it's not button or , so "title" attribute is enough for that. You can try dev version of the module or I will add a new module version later on this week.
- πΊπΈUnited States heatherwoz Seattle
Thanks @levmyshkin
That solution doesn't work for us, because captions are optional, and sometimes users don't enter them. They are also highly configurable by this module.
I think a better approach is to use the alt text from the image itself. Drupal includes an alt text field on its image fields, so we can reasonably expect this to be filled out. I have opened an MR to show what I am thinking. I also removed all the references to $data-gbox-img-attributes since that is not used with GLightbox the same way it was with Colorbox.
-
levmyshkin β
committed 3d3031b4 on 1.0.x authored by
heatherwoz β
Issue #3532876: Add alt text on lightbox images
-
levmyshkin β
committed 3d3031b4 on 1.0.x authored by
heatherwoz β
- π¦π½Γ land Islands albertho425 Seattle, WA
Thanks @levmyshkin and @heatherwoz. I agree with Heather of using the ALT text from the image itself. In my case, images in Gutenberg are required for saving.
- π·πΈSerbia levmyshkin Novi Sad, Serbia
Hi heatherwoz, albertho425, thank you for your MR! I merged it and released Glightbox 1.0.18:
https://www.drupal.org/project/glightbox/releases/1.0.18 βIt looks fine for me:
https://drupalbook.org/ept/demo/video-and-image-gallery
https://drupalbook.org/ept/demo/image-gallery - πΊπΈUnited States heatherwoz Seattle
Thanks for the prompt response! I will try out the new release and open a new issue if we encounter any problems.
- π¦π½Γ land Islands albertho425 Seattle, WA
Thank you both. We'll try it on Sunday and submit a new ticket if we encounter any issues. Thanks.