No redundant image alt

April 3, 2023 ยท View on GitHub

Rule Details

<img> alt prop should not contain image or picture as screen readers already announce the element as an image.

This rule does not discourage conveying the medium of the image which may be considered important to help a user better understand the content. For example, this rule will not flag terms including screenshot, painting, or photograph.

Resources

Examples

Incorrect code for this rule ๐Ÿ‘Ž

<img alt="picture of Mona Lisa" src="monalisa.png">
<!-- also bad -->
<img alt="image of a fluffy dog" src="monalisa.png">

Correct code for this rule ๐Ÿ‘

<!-- good -->
<img alt="Mona Lisa" src="monalisa.png">
<!-- also good -->
<img alt="The original painting of Mona Lisa hangs on the wall of Louvre museum" src="monalisa.png">
<!-- also good -->
<img alt="Screenshot of the user profile Settings page, with the 'Notifications' item highlighted" src="settings_page.png">