How to add gallery alt text to images?

Hey @eidolem :wave:.
It’s possible to add captions to image galleries by using the field that appears under a gallery when it’s selected. I don’t think it’s a huge problem in terms of SEO, however I do understand your concerns with accessibility. I did a little research into this: How do you figure? | scottohara.me

It’s appears that some screen readers don’t announce the gallery container with the caption within it. A little JavaScript can help us improve this:

[...document.querySelectorAll('figure.kg-gallery-card.kg-card-hascaption')].map(gallery => {
	gallery.setAttribute('role', 'figure')
	gallery.setAttribute('aria-label', gallery.querySelector('figcaption').innerHTML)
});

This code will add a role of figure to every gallery and use the containing caption to label the gallery :slight_smile:

1 Like