Accessible Object Elements and Alternative Text
Rule ID: object-alt
Ruleset: axe-core 4.10
User Impact: Serious
Guidelines: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), Section 508, EN 301 549
How to Fix the Problem
To ensure accessibility, all <object>
elements embedded in a web page must have an appropriate and descriptive text alternative. This can be achieved by using one of the following methods:
-
Using the
title
attribute: -
Using the
aria-label
attribute: -
Using the
aria-labelledby
attribute:
First, define a visible label:Then reference it from the object:
-
Using
role="presentation"
orrole="none"
if the object is purely decorative and conveys no content or functionality:
Do Not Use:
-
Empty
<object>
elements. -
<object>
tags with empty child elements like<div> </div>
. -
Objects containing generic fallback content like “This object has no alternative text.”
These will fail accessibility checks and negatively impact screen reader users.
Why it Matters
The <object>
element is used to embed external resources like multimedia or web pages. However, these elements are inherently non-text, meaning they cannot be interpreted by screen readers unless a meaningful text alternative is provided.
Without alternative text:
-
Screen readers cannot convey the purpose or content of the embedded object to blind or visually impaired users.
-
Users may hear only a vague description like “object” or hear nothing at all, causing confusion and a barrier to accessing content.
By providing a text alternative, you ensure that:
-
Users understand the purpose or content of the embedded object.
-
The experience for screen reader users is equivalent to that of sighted users.
When crafting alternative text, consider:
-
Why is this object here?
-
What does it represent or do?
-
What text would I use if this object couldn’t be seen?
Avoid including unhelpful words like “image,” “object,” or file names, which do not add value to the description.
Rule Description
Every embedded <object>
must include a descriptive and meaningful text alternative, allowing screen readers to interpret and convey its purpose or content to users.
The Algorithm (in simple terms)
The rule checks every <object>
tag in the HTML. If it doesn’t find:
-
a
title
attribute, -
an
aria-label
attribute, -
an
aria-labelledby
reference, -
or a
role
ofpresentation
ornone
,
then it flags the element as failing the accessibility check.