Alt text missing on lightbox images

Created on 27 June 2025, 14 days ago

Problem/Motivation

Alt text does not appear for the images in the lightbox. An alt attribute is present on the thumbnail images, and there are some data attributes on the link referring to it, but the values don't get passed to the lightbox image. There is an empty alt tag there.

In addition, the aria-label for the link is set to the entire contents of data-gbox-img-attrs. That doesn't seem correct.

Steps to reproduce

Use the glightbox responsive formatter on a field.
Click on thumbnail image to open the lightbox.
Inspect the image and look for its alt attribute.

Proposed resolution

Something seems off in template_preprocess_glightbox_formatter. The data-gbox-img-attrs attribute is added to the variables and template markup, but I don't see how this is used. Seems like we need to set the data-alt attribute or add the alt to the list of values for data-glightbox attribute.

Remaining tasks

Refactor template_preprocess_glightbox_formatter to add all the img attributes/data options correctly so that glightbox can use them.

User interface changes

none

API changes

none

Data model changes

none

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States heatherwoz Seattle

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024