Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 1.04 KB

File metadata and controls

34 lines (21 loc) · 1.04 KB

Accessibility: Image must have alt attribute with a meaningful description of the image. If the image is decorative, use alt="" (@microsoft/fluentui-jsx-a11y/image-needs-alt)

💼 This rule is enabled in the ✅ recommended config.

Rule details

This rule requires all <Image> components have non-empty alternative text. The alt attribute should provide a clear and concise text replacement for the image's content. It should not describe the presence of the image itself or the file name of the image. Purely decorative images should have empty alt text (alt="").

Examples of incorrect code for this rule:

<Image src="image.png" />
<Image src="image.png" alt={null} />

Examples of correct code for this rule:

<Image src="image.png" alt="A dog playing in a park." />
<Image src="decorative-image.png" alt="" />

Further Reading