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

Improve the Gallery images alt attribute within the editor block #16886

Closed
afercia opened this issue Aug 2, 2019 · 2 comments
Closed

Improve the Gallery images alt attribute within the editor block #16886

afercia opened this issue Aug 2, 2019 · 2 comments
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Media Anything that impacts the experience of managing media [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Aug 2, 2019

Describe the bug
Gallery images in Gallery block within the editor are typically rendered with the following markup (new lines are for better readability in this example):

<img
	src=" ... "
	alt="Huatulco Coastline"
	data-id="770"
	tabindex="0"
	aria-label="image 3 of 4 in gallery"
>

The aria-label="image 1 of 4 in gallery" overrides the alt attribute, making the images not recognizable by screen reader users. The only available information is image 3 of 4 in gallery, which doesn't help that much.

To reproduce
Steps to reproduce the behavior:

  • create a post
  • insert a gallery containing images with alt attributes
  • check the source in your browser's dev tools
  • see both the alt attribute and the aria-label attribute are present
  • optionally: try to use a screen reader and navigate to a gallery image within the editor (that's not easy)
  • verify the images are announced only with the aria-label content, e.g. image 3 of 4 in gallery

Expected behavior
The alt attribute to not be overridden

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Possible solution:

  • Prepend the alt attribute (if any) to the aria-label
  • To be verified: whether the info image 3 of 4 in gallery is really necessary: gallery images are within list item and the number of items should be automatically announced by screen readers
@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Aug 2, 2019
@swissspidy swissspidy added [Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Media Anything that impacts the experience of managing media labels Aug 2, 2019
donmhico added a commit to donmhico/gutenberg that referenced this issue Aug 20, 2019
@paaljoachim
Copy link
Contributor

@glendaviesnz Glen

As your working on #25940
I do believe this is an issue you might want to know about.

@glendaviesnz
Copy link
Contributor

With the merging of the gallery block refactor the gallery images are now Image blocks, which don't currently have an aria label so alt tag should be read by default.

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 [Feature] Media Anything that impacts the experience of managing media [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants