Uuh, an #a11y rabbit hole to dig into - sign me up! I too use a11y.css for validation and have been wondering about this notification.
From what I have researched, this is to support browser-screenreader pairings that do not recognize the semantic meaning of <figure>
(which has an implicit ARIA role of figure
, so it seems redundant). I could not find a “requirement” source, but this is being recommended in the WAI Web Accessibility Tutorial on “Complex Images”:
The HTML5 <figure>
and <figcaption>
elements can be used to group image and link semantically. Adding role="group"
to the figure maintains backward compatibility with web browsers that don’t support the native semantics of the <figure>
element.
Yet, Scott O’Hara has an extensive article about how different screen reader setups consume <figure>
tags, and he suggests:
<figure role="figure" aria-label="repeat figcaption content here">
<!-- figure content. if an image, provide alt text -->
<figcaption>
Caption for the figure.
</figcaption>
</figure>
This is to support AT setups with IE11 as well as VoiceOver and Chrome. Now, which recommendation to follow? Two trustworthy sources recommending two different best practices confuses me. But I do understand the a11y.css warning better, now.
Here is how WAI-ARIA defines group
as used in the WAI Tutorial…
A set of user interface objects which are not intended to be included in a page summary or table of contents by assistive technologies.
…vs. how figure
is defined, as suggested in Scott O’Hara’s recommendation:
A perceivable section
of content that typically contains a graphical document, images, code snippets, or example text. The parts of a figure
MAY be user-navigable.
Personally, I’m leaning towards role="figure"
, as that is the implicit role of <figure>
and role="group"
would override that with a different semantic. And there is an open Github issue on the WAI Tutorial page supporting that view (apparently role="figure"
was not available when the tutorial page was first authored).