This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.

Complex Images

in Images Tutorial

Long descriptions

There are situations where the composition of an image is important and needs to be provided in the long description. For example, the sequence of colors used and the relative heights of the columns in a bar chart may be relevant information about the structure of the chart, in addition to the actual values and trends that it depicts.

Remember that complex images can be difficult to understand by many people – in particular people with learning disabilities and people with low vision. Long descriptions benefit many people, and it is good practice to make them available to everyone, for example, as part of the main content. It may also be possible to reduce unnecessary complexity in your images and make them easier to understand for everyone.

It is also good practice to refer to and summarize more complex images from the accompanying text. For example, a reference such as “The following graph shows that visitors were lost in the first quarter, but the numbers recovered in the second quarter” helps to point out the relevant information that the image is intended to present.

Example 1: Description containing structured information

In this example, a bar chart of website visitor statistics has the short description “Bar chart showing monthly and total visitors for the first quarter 2014 for sites 1 to 3”, provided through the alt attribute of the image. The long description provides detailed information, including scales, values, relationships and trends that are represented visually. For example, the long description can point out the declining values for site 1, consistent values for site 2, and increasing values for site 3 that are encoded in the bar chart. The longdesc approach used in the following example is described later in the section.

Among the approaches below, the first and fourth one make the information available to other programs, such as web browsers and search engines.

This approach provides a text link next to the image that refers to a separate web page or a section of the same web page that contains the long description. The link text needs to clarify the destination, and associate it with the image.

This approach is supported by all web browsers and assistive technologies and makes the long descriptions available to everyone. However, the link is not associated with the image in a semantic way.

The HTML5 <figure> and <figcaption> elements can be used to group image and link semantically. Adding role="group" to the figure maintains backward compatibility with web browsers that don’t support the native semantics of the <figure> element.

Approach 2: Describing the location of the long description in the alt attribute

When a long description is provided on the same web page as an image, its location can be described using the alt attribute of the image. The location information needs to be clear and accurate to help users locate the content.

Approach 3: Structurally associating the image and its adjacent long description (HTML5)

Open Issue Issue #2 — Further guidance on figures

Open Issue Issue #604 — Consider removing role=group advice

The HTML5 <figure> element can be used to enclose both the image and its long description. The long description (presented as headings, text, and a table) is wrapped in the <figcaption> element. It is explicitly associated with the image using role="group" on the containing <figure> element in web browsers that don’t convey the semantics of the <figure> element.

Open Issue Issue #599 — Remove this section depending on the outcome of this issue.

The longdesc attribute can contain the URI of a separate web page that provides the long description for an image or a fragment identifier that refers to an element on the same page that provides the long description.

When the longdesc attribute contains a URI to refer to another web page with the long description, it is recommended to also apply Approach 3 (a text link to the long description adjacent to the image). This method is a workaround for web browsers and assistive technologies that don’t fully support the longdesc attribute.

When the longdesc attribute contains a fragment identifier (# followed by the id of an element on the same web page - a “hash link”), it refers to an element on the same web page that provides the long description. It addresses a similar use case as Example 2, Approach 1, though the support by web browsers and assistive technologies may vary. An additional link (by applying Approach 2) is not needed when the long description is in close proximity to the image.

Example 2: Description containing textual information

The WAI-ARIA aria-describedby attribute can be used to link to a description of the image that is provided anywhere on the same web page, in a similar way to the longdesc approach. The value of the attribute is the id of the element that provides the long description.

Important: The element referenced by aria-describedby is treated as one continuous paragraph of text. Screen readers and other assistive technology do not have access to structural information, such as any headings and tables. They will read out or provide the text of any contained elements without indicating their structural relationships, and without the corresponding navigation mechanisms. As a result, this approach only works for long descriptions that are text-only, without needing structural information as was needed in the previous example.

In this example, the head of the peacock is described using a paragraph of text that is on the web page.

Back to Top

This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.