Created
May 7, 2021 08:26
-
-
Save Lelith/b856e8fe36cb69d07f59029c70795baa to your computer and use it in GitHub Desktop.
How to make images accessible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// image with a descriptive alternative text, helps users to understand what is on the picture | |
<img src='cat.jpg' alt="a cat playful laying on its back" /> | |
// image for decorative purpose which adds unnecessary information | |
// Screenreaders will read this as "image, Dashboard Logo, My Dashboard" | |
<div> | |
<img src="dashboard_black_24dp.svg" alt="Dashboard Logo" />My Dashboard | |
</div> | |
// just removing the alt-tag is not helpful either | |
// Screenreaders will read this as "Image without title, dashboard black 24p, My Dashbaord" | |
<div> | |
<img src="dashboard_black_24dp.svg" />My Dashboard | |
</div> | |
// Hide non-descriptive images via inline pasting or aria-attribute | |
<div> | |
<svg>...</svg> My Dashboard | |
</div> | |
<div> | |
<img src="dashboard_black_24dp.svg" aria-hidden="true" /> My Dashboard | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment