Accessibility Insights

Back to Info and Examples for Accessibility Insights for Web

object-alt

An <object> element must have alternative text.

Why it matters

An <object> element is used to embed multimedia content in a web page. It can also be used to embed one web page inside another.

Alternative text is a word or phrase that (1) is coded in a way that assistive technologies can associate it with a specific non-text object, and (2) conveys the same information as the non-text object.

Because assistive technologies can’t interpret objects directly, they rely on alternative text to communicate the meaning of non-text content to users.

How to fix

For each <object> element, provide alternative text using one of the following methods.

Good

  • title attribute

Better

  • aria-label attribute

Best

  • aria-labelledby attribute

For tips on writing good text alternatives, see Providing short text alternative for non-text content that serves the same purpose and presents the same information as the non-text content.

Example

 

Fail

This <object> element doesn't have alternative text. Assistive technology users won't have any idea what information the object contains unless they interact with it.

<object type="application/pdf" data="/media/beeth_fe.pdf" width="250" height="200">
</object>
 

Pass

The <object> element uses an aria-label attribute to provide alternative text. Assistive technology users can judge from the name whether the object is likely to have useful content.

<object type="application/pdf" data="/media/beeth_fe.pdf" width="250" height="200" aria-label="Sheet music for Beethoven's "Für Elise">
</object>

About this rule

This rule passes if ANY of the following is true:

  • Element has a non-empty aria-label attribute
  • Element has an aria-labelledby attribute that references elements that are visible to screen readers
  • Element has a non-empty title attribute
  • Element’s default semantics were overridden with role="presentation" or role="none"

Important: Use caution when applying role="presentation" or role="none" to an <object> element. These roles instruct assistive technologies to disregard the element’s implicit role without hiding its content from users. If an <object> element with a role of presentation or none has inner text, it will be reported to users as a text string with no semantic context. For more information, see Using ARIA: Use of Role=presentation or Role=none.

More examples