Ross Esmond

Code, Prose, and Mathematics.

portrait of myself, Ross Esmond
Written — Last Updated

Alt-text

Alternative Text is any text used as a fallback when an image or pictorial element cannot be accessed or perceived. Alt-text is most often associated with the accessibility needs of blind users, but it serves other purposes as well. For example, images may go offline before their surrounding document, resulting in a degraded reading experience for new users who will not perceive the information captured in the image. If the image had quality alt-text, however, the reading experience may still be acceptable. The alt-text serves as a fallback to the image in any instance where the user cannot perceive the image, either due to disability or technical issues.

There are two main approaches to writing alt-text. It can either mirror the information in the image, or it can identify the information in the image. Mirroring the information in the image involves determining what the image was intended to convey, and capturing it as text. When the information in the image is simple to convey or is not present elsewhere in the document, the alt-text should mirror the information. If, however, the information is difficult to convey and is ancillary to the document, the alt-text may simply identify the information in the image. Identifying the information in the image involves describing the purpose of the image and why its information is not being fully conveyed. This would be acceptable if the media is itself an alternative to the main text of the document, such that the alt-text would be redundant, if the media is part of a test that would be rendered meaningless if an alternative is provided, or if the media provides a sensory experience that would be impossible to capture as text. See the non-text content section of WCAG 2.1.

When mirroring the information in the image, the document author must be able to realize what is actually conveyed by the image. Alt-text need not describe every detail of the image; only the parts that a user was intended to realize about the image. For example, the image below shows then-President Ronald Reagan smiling in a suit and tie, standing in front of several flags, one of which appears to be the US flag. Unless the user was intended to realize these innocuous details, it is not necessary to capture them in the alt-text. For most uses of the image, the alt-text “the Official Portrait of President Reagan” describes the information of the image perfectly. In fact, describing the image further runs the risk that the document author will accidentally use visual details in their description, which may be worthless to a blind user. A user who was blind at birth would generally not glean any more insight from the detail that Reagan’s suit was dark blue.

The Official Portrait of President Reagan.

There are cases, however, where the information in the image should not be captured in the alt-text. The example provided by WCAG 2.1 is that of a diagram of an engine where the details expressed in the diagram are already captured in the main text of the document. In this example, the diagram is ancillary to the surrounding document, and once the image itself cannot be viewed, its purpose cannot be recaptured by the alt-text any better than has already been achieved. In this instance, the purpose of the alt-text shifts towards conveying to the user what was in the image, and why the image is not necessary. For blind users, this will assure them that they are not “missing out” on information, and during archival, this will assure the user that the document is not being served in a severely degraded form.