1. Getting Started
  2. Installation: Preline UI

Accessibility

<object> elements must have alternate text

Screen readers have no way of translating non-text content into text announced to users. Instead, they read out alternative text. For screen reader users to obtain the information contained in embedded object elements which must contain short, descriptive alternative text.

The object element defines an embedded object within a document. It is used to embed multimedia (audio, video, applets, etcetera.) or another web page into the document. The object element needs a text alternative so that users of screen readers know the contents of the object.

When writing a text alternative, keep in mind that the purpose of the alternative text is to relay information to blind users about the image’s contents and purpose - blind users should be able to get as much information from alternative text as a sighted user gets from the image. Alternative text should give the intent, purpose, and meaning of the image.

When writing alternative text, it’s helpful to keep the following questions in mind:

Be sure that all text contained in this attribute is useful. Words like “chart”, “image”, “diagram”, or image file names tend not to be very useful.

Fixing the problem

Add alternative text to all embedded <object> elements using either inner text, title attributes, aria-label or aria-labelledby.

The object-alt rule has six examples that pass analysis:

<object id="pass1">This object has text.</object>
<object id="pass2" title="This object has text"></object>
<object id="pass3" aria-label="this object has text"></object>
<span id="label1">this object has text</span>
<object id="pass4" aria-labelledby="label1"></object>
<object id="pass5" role='presentation'></object>
<object id="pass6" role='none'></object>

The object-alt rule has three examples that fail analysis:

<object id="violation1"></object>
<object id="violation2"><div>
</div></object>
<object id="violation3"><p style="display: none;">This object has no text.</p></object>