WCAG H67: Using null alt text and no title attribute on img elements

Rule ID:
wcag/h67
Category:
Accessibility
Standards:
  • WCAG 2.2 (A)
  • WCAG 2.1 (A)
  • WCAG 2.0 (A)

WCAG H67 requires decorative images to have empty alt text (alt="") and empty or absent title.

Rule details

Examples of incorrect code for this rule:

<img title="Lorem ipsum">
error: <img> with empty alt text cannot have title attribute (wcag/h67) at inline:1:6:
> 1 | <img title="Lorem ipsum">
    |      ^^^^^


1 error found.

Examples of correct code for this rule:

<!-- empty alt text and no title is interpreted as purely decorative -->
<img alt="">

<!-- alt text is used together with title, the image carries meaning and will not be ignored by AT -->
<img alt="Lorem ipsum" title="Lorem ipsum">