Alt Text: Easy Enough, or so You'd Think

I'm currently working through the "Images, SVG, and Canvas" module of the Deque University WAS prep-course, and I'm surprised by how specific and helpful the information is.

There's a lot more than just adding alt text to images. The big revelations dealt with image maps, visuals that would require excessive explanation not appropriate for an alt text, images instead of buttons, geographical maps, and text alternatives for data visualizations.

Image Maps

Firstly, I completely forgot that image maps were a thing. I vaguely remember abusing this option when making a websites in the early 2000 because it allowed you to simply identify hot spots as links on a robust image background instead of dealing with HTML buttons, or actual code. 

If you're unable to use a more appropriate solution than an image map, you'd need to:

  • provide alt text on the background image to summarize the context of the area alt text
  • provide alt text describing the map area within that context

Screen shot of a visual flow chart example and the code illustrating proper alt text for image map areas on the flow chart

 One mistake I made when I started the practice site, was that I added alt text to an image that rambled on because I was tired of writing boring alt text and thought I'd be funny. Turns out, yes, there's a limit you should stick within. 

You start to lose the audience if it goes over 150 characters, and alt text doesn't allow the user to navigate within it like other content does. You should stick to a short, succinct description of the image to help the user experience the benefit of the visual content the same way a sighted user would. 

Screen shot of code inspector showing alt text for the profile image of Danielle in the practice site

Excerpts and Long Descriptions

If there is important information that can't responsibly be included in alt text, using an excerpt to convey the more lengthy information helps the user:

  • get an idea about the image
  • be able to navigate and read the long description as a part of their normal page navigation
  • be able to skip the excerpt if they desire
You can chose to include the lengthy text in an expandable container to save on page space, or have it available via a link.

This type of thing is more relevant to images that are more complex than stock photos such as, artistic representation of concepts/symbolism or images used to illustrate graphical data or diagram.

Image Buttons

If you're using images in place of semantic button elements, the alt text needs to convey the action of the button, and you don't need any alt text on an image that displays as the background via CSS. If you have an image in the background as apart of the page code, however, keep it blank with alt=" ".

Geographically Maps

From the context of "you need alt text on images" when you have a map of city streets in front of you, your immediate thought is, "Uhhhh... how do I alt text this?" You can't describe the directions and cross streets of a city map in alt text.

Short answer is you really don't aside from providing text for the user to understand where the map visual is on the page. The approach to take is they are looking at the map in order to get directions, so focus on making the list of directions, and the the ability to search for directions as accessible as possible.

Data Visualizations

Similar to geographical maps, it requires a lot more than 150 characters to convey the full message of a bar chart or other data visualization.

You should still include alt text for the data visualization, but keep it short and summarize the goal of the data. 

Amy Cesal has a helpful list of specific things to include as a standard such as:

  • Chart type
  • Type of data
  • Reason for including chart
  • Link to raw data somewhere in the page text if available

Colored bar chart illustrating the dramatic increase in temperature from 1850-2019

Image of Amy's list of items to include in alt text from the example graph above

Popular posts from this blog

Practice Site: Keyboard Accessible Tooltip Fail

Pointer Cancellation: Real-World Examples

Practice Site: Accessible Forms