Skip to content

Rule · Accessibility

role="img" element has no text alternative

a11y/role-img-alterrorvoid a11yupdated

Why it matters

Elements with role="img" (icon spans, CSS background images) have no alt attribute, so without a name they are announced as unlabeled images.

How to fix it

Add aria-label or aria-labelledby. For purely decorative elements remove role="img" and use aria-hidden="true".

References

void a11y reports 48 rules in this category. WCAG 2.2 AA through axe-core, plus checks axe can't do alone: visible keyboard focus, 24/44px target size on mobile, 320px reflow and disabled zoom.