DEV Community

loading...

Discussion on: Why you should never ignore the alt attribute

Collapse
rokuem profile image
Mateus Amorim

It is also interesting to mention that this could be valid to assertive tecnologies:

<div role="img" aria-label="Something you would place in an alt attribute that describes the entire image">
   <img src="./assets/img1.jpg" />
   <img src="./assets/img2.jpg" />
</div>

Assertive technologies will treat it as a black box and use the aria-label instead.

btw, it seems like the "resolutions" image alt was not included in the post text, just the image element.

Collapse
nataliedeweerd profile image
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝 Author

Ah! Thanks for pointing that out to me! I'd added it to the actual alt attribute, but not included it in the copy beneath.

And thanks for your comment on aria-label's! There are now so many ways of making your site accessible - for this post I wanted to touch on the absolute bare minimum.