object-alt

<object> elements must have alternate text

Who might be affected
SR

Description

The <object> element is used to represent an external resource, such as files, videos, and HTML pages, or a resource to be handled by a plugin like flash or ActiveX. In many cases, a screen reader does not have the ability to read and parse the content displayed within the object element in order to read it to the user. Therefore it must be provided with an accessible name that describes its content as an alternative for screen readers. Alternatively, if the object element's purpose is purely presentational, you could signify it by using role="none" or role="presentation". This will remove the object element from the accessibility tree.

Quick Fixes

Provide <object> elements with accessible names.
1 <!-- Use the "aria-label" attribute -->
2 <object type="application/pdf"
3 data="/media/examples/file.pdf"
4 aria-label="file name or description">
5 </object>
6
7 <!-- Use the "title" attribute -->
8 <object type="application/pdf"
9 data="/media/examples/file.pdf"
10 title="file name or description">
11 </object>
12
13 <!-- Use a child text node. Make sure it is available on the a11y tree -->
14 <object type="application/pdf"
15 data="/media/examples/file.pdf">
16✓ file name or description
17<span style="display: none;">
18✗ file name or description
19</span>
20 </object>
21
22 <!-- Use another element to lable the "objebt"
23 element with the "aria-labelledby" attribute -->
24 <h3 id="file-name">file name or description</h3>
25 <object type="application/pdf"
26 data="/media/examples/file.pdf"
27 aria-labelledby="file-name">
28 </object>
If the <object> element's purpose is purely presentational, make assistive technologies ignore it.
1 <object type="application/pdf"
2 data="/media/examples/file.pdf"
3 role="presentation">
4 </object>
5
6 <object type="application/pdf"
7 data="/media/examples/file.pdf"
8 role="none">
9 </object>

How Users Are Affected

Users that are dependent on screen readers, or other assistive technology that uses text parsing to convey the content to the user, will not be able to perceive the content.

WCAG Success criteria

This issue might cause elements to fail one or more of the following Success criteria:
1.1.1 Non-text Content (A)

Recommended Reading