Skip to content

STR-005 Give images and icons that carry information a text alternative, and hide the ones that only decorate

Level
Rule
Verdict
Requirement
Status
proposed, version 1.0.1

Rule

Give an image or icon that carries information a text alternative that says what it tells the person in that place, never a file name or a word that only names the kind of picture. Hide one that only decorates from assistive technology, with alt="" on an img or aria-hidden="true" on an icon.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: The icon that carries the status has a name

Invoices

  • Invoice 2026-114
  • Invoice 2026-113Paid
The red clock is the only sign that invoice 2026-114 is overdue, so it is a graphic named "Overdue". The tick before Paid only repeats the word, so it is hidden and the row reads once.

Don't: The only sign of the status is hidden

Invoices

  • Invoice 2026-114
  • Invoice 2026-113Paid
The same row, but the clock is hidden with aria-hidden and nothing else says the invoice is overdue. A sighted person sees the problem; a screen reader user never learns of it.

Do: Avatars named, or empty, by what is beside them

Customers and team

  • Lena Okafor
  • Lena OkaforTomas ReyesMaya Lindqvist
Beside a name, the picture adds nothing and has an empty alt. In the row of faces with no names, each picture carries the person's name.

Don't: A file name and a kind of picture as alternatives

Invoices and customers

  • Invoice 2026-114clock-red-2.svg
  • AvatarLena Okafor
The overdue clock is an img whose alt is its file name, and the avatar's is "Avatar" beside a name that is already there. The first says nothing useful; the second adds noise to every row.

Why

A screen reader cannot see a picture. It reads the text the picture carries in code, and nothing else. A red icon that marks an invoice as overdue says "overdue" to a sighted person; with no text alternative, a screen reader user never learns it. The opposite fails too. An icon that only repeats the word beside it, read aloud as "image" or as a file path, wastes the person's time on every line of a list and buries what matters.

This is a requirement. WCAG 2.2, 1.1.1 Non-text Content asks that anything shown as other than text comes with text that does the same job, and that pure decoration is built so assistive technology can ignore it (Understanding 1.1.1). The Working Group lists as failures an alternative that is only a file name or a placeholder word (F30), and a decorative image given any alternative other than an empty one (F39). Its technique for hiding an img is an empty alt and no title (H67). Whether an image is decorative is the author's judgement from why it is there. Ask what a screen reader user would miss if the image said nothing. If the answer is nothing, it decorates.

Do

  • In the invoice list of the bookkeeping app Fernhill, an overdue invoice shows a red clock icon and no text. The icon carries the status, so the SVG has role="img" and aria-label="Overdue", or a visually hidden span with "Overdue" sits beside it. Better still, our own choice: show the word Overdue next to the icon and hide the icon.
  • A Badge reads Paid with a tick icon before the word. The icon adds nothing to the word, so it has aria-hidden="true".
  • The adapter's icons (adapters/shadcn/src/lib/icons.tsx) set aria-hidden="true". With any other icon library, check what it does before relying on it, and give the icon a name when it alone carries meaning.
  • A customer's AvatarImage sits next to their name, Lena Okafor. The name is already there, so alt="". In a row of avatars with no names beside them, each alt is the person's name.
  • A bar chart of monthly revenue has a short alternative, such as "Revenue rose each month from January to June", and the figures in a table or a sentence nearby. The figures do not go into alt.
  • With next/image, alt is required. Write what the image tells, or alt="" when it decorates; never the component's or the file's name to make the type error go away.
  • Our own choice: keep an alternative to one or two short sentences, and do not start it with "Image of" or "Picture of". The screen reader already says it is an image.
  • Our own choice: do not repeat in alt the caption or heading right beside the image. When nearby text already says what the image tells, alt="" is right.
  • Avoid images of text; WCAG 2.2, 1.4.5 Images of Text covers when they are allowed. When one is used, its alternative holds the same words.
  • A spinner beside "Saving invoice …" is decorative; the text says what is happening, as STA-005a asks.
  • An emoji that carries meaning in a label, such as a warning sign, needs words that say what it means. One that only decorates is hidden in a span with aria-hidden="true".

Don't

  • Write <img src={url} /> with no alt at all. Many screen readers then read the file name or the address.
  • Write alt={file.name}, alt="logo", alt="hero" or alt="screenshot".
  • Hide the overdue icon with aria-hidden="true" when nothing else on the row says the invoice is overdue.
  • Give a decorative divider image alt="decoration" instead of alt="".
  • Give an AvatarImage alt="Avatar".
  • Show information as a CSS background image. A background image cannot carry a text alternative.

Exceptions

  • Icon buttons. An icon that is itself a button, or the only content of one, is named as ACT-001b says, after what pressing it does.
  • Image links. An image or icon that is itself a link, or its only content, is named as TXT-003 says, after where it goes.
  • Flags in a language picker. A flag that is the only label of a language needs a text alternative under this rule. The language name beside it, and the lang it carries, are STR-006a.
  • Loading signs. How a wait is announced is STA-005a and FBK-004. This rule only says the spinner graphic itself is decorative when text says what is happening.

Verdict

Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on STR-005
SourceRoleStancePage
WCAG 2.2LawRequires1.1.1 Non-text Content
Material DesignJudge SupportsAccessibility designing: elements
Alt text
Apple Human Interface GuidelinesJudge SupportsVoiceOver
Carbon Design SystemJudge SupportsAccessibility: Developers
GOV.UK Design SystemExpert witness SupportsImages
Nielsen Norman GroupExpert witness SupportsAlt Text: What to Write, by Emma Cionca, Tanner Kohler

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.1, : Points to STR-006a for a flag in a language picker.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Page structure: 7 rules and 1 guideline · All rules