dequelabs / axe-core

Accessibility engine for automated Web UI testing
https://www.deque.com/axe/
Mozilla Public License 2.0
5.75k stars 746 forks source link

Critical error of alt attribute not present is thrown even if image is wrapped inside `<figure>` element and a caption is provided in `<figcaption>` element. #4473

Open manav-sharma69 opened 1 month ago

manav-sharma69 commented 1 month ago

Product

axe Extension

Product Version

4.80.1

Latest Version

Issue Description

Expectation

The extension should not throw warning because <figcaption> element was present to provide caption for the image.

Actual

The extension threw a critical level issue titled "Images must have alternate text".

How to Reproduce

The site tested was MDN's demo of Basic View Transitions.

Screenshot: alt attribute error

Additional context

W3's Guidance for conformance checkers says:

straker commented 4 weeks ago

Thanks for the issue.

So I tested out the following HTML using different combinations of screen readers and browsers, and this is the result:

<!-- A -->
<figure>
  <img src="https://mdn.github.io/dom-examples/view-transitions/images/jungle-coast.jpg">
  <figcaption>Jungle coast</figcaption>
</figure>

<!-- B -->
<img src="https://mdn.github.io/dom-examples/view-transitions/images/jungle-coast.jpg">

<!-- C -->
<img src="https://mdn.github.io/dom-examples/view-transitions/images/jungle-coast.jpg" alt="cool image of Jungle">

Based on the results it looks like VoiceOver and Safari does not really work with figure. Because of this we may call this an accessibility supported issue and it would still be a violation. I'll confirm with the team and let you know if that's not the case.