Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add alt text to Gallery images #17618

Closed
iandunn opened this issue Sep 26, 2019 · 13 comments
Closed

Can't add alt text to Gallery images #17618

iandunn opened this issue Sep 26, 2019 · 13 comments
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Type] Enhancement A suggestion for improvement.

Comments

@iandunn
Copy link
Member

iandunn commented Sep 26, 2019

Problem

There's no way to set the alt text on the images that are in a Gallery block. You can add captions, but that serves a different use case.

If the image is locally hosted, you can add alt text through the Media Library, but that's too inconvenient, and most users won't, especially if they uploaded the image via drag-n-dropping it to the current post.

If the image is external, there's no way to set the alt text.

Related #13164, #16886, #12351

Proposed Solution

After clicking on an image, there should be some kind of UI that allows for setting the alt text. I'm not sure what the best way would be, though. Maybe something similar to the caption UI.

Or maybe the sidebar should contain some controls for each image, in addition to the controls for the block as a whole?

Alternative Solution

The Gallery block could use InnerBlocks, so that each image is a full image block, with all of the editing options available from that. That seems kinda messy and overly complex, though.

@iandunn iandunn added [Type] Enhancement A suggestion for improvement. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Block] Gallery Affects the Gallery Block - used to display groups of images labels Sep 26, 2019
@iandunn
Copy link
Member Author

iandunn commented Sep 26, 2019

Er, were they intentionally left out because galleries are considered purely decorative?

@peterpenguw
Copy link

galleries are very useful for picture heavy industries. Why anyone would leave this feature out on purpose would be puzzling.

@nikoghosyanm
Copy link

This functionality existed before and as I can see it was also an issue in the classic editor lately (fixed now) so it definitely needs to be fixed in Gutenberg too

@phpbits
Copy link
Contributor

phpbits commented Feb 18, 2020

@iandunn You can use the Edit Gallery option to easily manage the ALT text. Here's the instructions:

https://twitter.com/editorskit/status/1229715390965534720

@cre8tivediva
Copy link

Any idea when/if this will be addressed? I like @phpbits workaround, but this truly should be an option in the blocks. It's more than a "decorative" element to a lot of users.

@peterpenguw
Copy link

peterpenguw commented Feb 18, 2020 via email

@oldrup
Copy link

oldrup commented Feb 19, 2020

Update: after following the steps shown here: https://twitter.com/editorskit/status/1229715390965534720, the already existing alt tags of the images are actually being uses. So in my case, I just had to edit the gallery, not make any changes, and save it, and then the post validates. Odd.

Original post:

When testing for accessibility, its impossible to validate a post with a Gutenberg Gallery, as the alt tags added in the media library are not being used.

WebAIM wave report of a Gutenberg / Twenty Twenty site: https://wave.webaim.org/report#/https://labs.oldrup.net/demodata2/

What makes this even weirder is that the img elements in the gallery, actually contains an alt tag, its just completely empty.

In my opinion the alt tag of images added in the media library, should be output if they exists. Just as the are in individual image blocks. At least make it optional, so a error free accessibility is possible.

Best regards
Bjarne

@taija
Copy link

taija commented Feb 19, 2020

We use WordPress for our primary CMS in a large institution that requires accessible content; this has been causing confusion for a bunch of our content managers. I echo thanks for the work-around, but this really needs to be fixed in the block itself!

@haraldballuch
Copy link

haraldballuch commented Apr 4, 2020

I totally agree with @oldrup: If there is alt text, it should be included in the ouput of gallery images.
At least in twentytwenty theme this doesn't work. There is always added alt="" to the img tags inside of galleries completely ignoring if there is an alt text for this image or not.

@haraldballuch
Copy link

Ok, sorry, it seems to be more complicated than this: Sometimes the alt information of images in a gallery is ignored and sometimes not. But until now I don't understand the conditions that must be met. So right now I am not able to reproduce this bug.

@skorasaurus
Copy link
Member

+1 the alt-text should be able to be set within the block itself, not within the media library.

alt-text does not describe the content of an image; it describes how the image is used in the particular context of a webpage. so it needs to be set at the time of the block creation or editing, not when the image is originally uploaded to WordPress.

The same image can be used on 2 different pages and its alt-text can be different if it is used in different contexts.

Has some examples of different alt-text usage: https://axesslab.com/alt-texts/

@enriquesanchez enriquesanchez added the Needs Accessibility Feedback Need input from accessibility label Nov 24, 2020
@strarsis
Copy link
Contributor

How can the alt or title be set for a gallery image? I can add a caption, which results in a figcaption, but I can't set a title or alternative text in the gallery itself. IMHO it would be better to have an alt or title for each gallery image, even when it had been set in the media library, than to have nothing at all.

@glendaviesnz
Copy link
Contributor

With the gallery refactor merged the alt tag can now be set on each image in the gallery block so closing this.

Screen Shot 2021-09-10 at 2 35 54 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests