Today I Learned - Rocky Kev

TIL Writing really good alt text

POSTED ON:

TAGS:

Good alt text is an art. So let's repeat that.

ALT TEXT INFO

WHAT ALT TEXT IS:

WHAT ALT TEXT IS NOT:

In fact, if you tried to detail everything in the image, then the actual focus, the bit that mattered in terms of the article, might get lost among the irrelevant detail. Like when you look up a recipe, and the bulk of the content is about how the smell of rosemary reminds the author of their childhood – sorry, don't care, I just want to know how to roast potatoes.

Writing great alt text: Emotion matters

THE RULE OF THUMB:

the intent is that replacing every image with the text of its alt attribute does not change the meaning of the page.

One way to think of alternative text is to think about how you would read the page containing the image to someone over the phone, without mentioning that there is an image present. Whatever you say instead of the image is typically a good start for writing the alternative text.

This isn't my opinion. This is directly from the HTML specs: https://html.spec.whatwg.org/multipage/images.html#alt

There's actually more to it, which I've covered in some other TILs, under accessibility.

For example:

EXAMPLES:

Via Write good Alt Text to describe images

Bad Alt text (don't use):
A picture of a empty stadium.

(No need to describe that it's a picture. It does not help with context.)

Alt-text with no context:
A mostly empty stadium.

Alt-text on a page about recent turnout for track tryouts:
Harvard Stadium with two lone runners bounding up the steps.

Alt-text on page about renovation projects:
Harvard Stadium with cracked concrete pillars.

Bad Alt text (don't use):
Tasty nachos! Yum!

(This does not describe the image. You also shouldn't add context to supplement the image)

Alt-text with no context:
Bag of Doritos, party size.

Alt-text on a store page:
Doritos Tortilla Chips, Nacho Cheese, 14.5 oz bag, party-size

Alt-text on page about food portions:
Party-size Doritos weighing 14.5 oz.

Via Alt Text

Bad Alt text (don't use):
Stack of 8 pancakes with 27 blueberries. A mint is on top. The pancakes are positioned centered on the plate, but the image itself is angled slightly to show half of the plate, and half of the panckes.

(Too much un-neccessary details. It's not actually explaining 'why' the image exists within the article.)

Alt-text with no context:
Stack of pancakes with whole blueberries as toppings.

Alt-text on a restaurant page:
8 crisp pancakes made with whole-grain flour, with organic blueberry toppings.

Alt-text on a cooking/recipe site:
Stack of pancakes with whole blueberries as toppings.

Via Alt Text


Related TILs

Tagged:

TIL aria-expanded for showing when things are hidden/shown

The aria-expanded attribute is set on an element to indicate if a control is expanded or collapsed, and whether or not its child elements are displayed or hidden.

TIL ARIA role presentation

Think of this as a reset. You use role=presentation to remove semantic meaning from an element.

TIL reduce-motion-blur

Dizziness and vertigo are symptoms of a vestibular balance disorder. If the user has set up a user preference that they prefer motion-based animation be disabled/reduced, we can tap into that. As web developers, we can also support them.