Aria Label unsupported without role
-
Pro Version user here – love the plugin…however…
Site Improve is warning us about auto-generated aria-label attributes on the chart div…
Description
An ARIA attribute has been specified that is either not supported or is prohibited, on this type of element.
Explanation:
The
divelement does not inherently supportaria-labelunless a role is specified that allows it. Addingrole="region"to thedivmakes thearia-labelattribute valid and improves accessibility by providing a meaningful label for the hidden content.Best practices:When using
aria-labelon adiv, ensure that thedivhas a role that supports this attribute, such asregion,alert, orapplication. This practice helps screen readers correctly interpret and announce the content.Example code:
<div aria-label="A chart." style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;">
<svg width="603" height="400" aria-label="A chart." style="overflow: hidden;"> </svg>
<div aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;">
<table> </table>
</div>
</div>Should be:
<div (NO ARIA LABEL or role="figure") style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;">
<svg width="603" height="400" role="img" aria-label="A chart." style="overflow: hidden;"> </svg>
<div role="region" aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;">
<table>
<thead> </thead>
<tbody> </tbody>
</table>
</div>
</div>Can you please help us improve our score by making these fully WIA-ARIA compatible?
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label
Note: While
aria-labelcan be used on any element that can have an accessible name, in practice however, it is supported only on interactive elements, widgets, landmarks, images, and iframes.https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles
Thanks in advance!
The topic ‘Aria Label unsupported without role’ is closed to new replies.