Skip to main content
Accessibility AccessLint 0.16

<object> elements must have alternative text.

About this AccessLint rule

The <object> element embeds external content such as images, audio, and video into a web page. When this embedded content is non-text content, screen reader users have no way to perceive or understand it unless an accessible name is provided. Without alternative text, the <object> element is either skipped entirely by assistive technologies or announced without any meaningful description, leaving users unaware of what the content is or why it's there.

This rule maps to WCAG 2.0 success criterion 1.1.1 (Non-text Content), a Level A requirement. Success criterion 1.1.1 requires that all non-text content presented to users has a text alternative that serves an equivalent purpose. Because <object> elements can render images, play audio, or display video, they fall squarely under this requirement.

A common misconception is that fallback content placed inside the <object> element (between the opening and closing tags) acts as alternative text. It does not. Browsers only display fallback content when the embedded resource fails to load. When the resource loads successfully, assistive technologies do not use the fallback content as the accessible name. This means you must provide an accessible name through other means.

How to fix it

Add an accessible name to every <object> element that renders non-text content. There are three supported techniques:

  • Use the aria-label attribute to provide the accessible name directly on the element.
  • Use the aria-labelledby attribute to reference the id of another element that contains the text alternative.
  • Use the title attribute to give the element a name.

If the <object> is purely decorative and carries no meaning, assign it role="presentation" or role="none" so assistive technologies ignore it. Some screen readers will still announce <object> elements without an accessible name, so a presentational role is the reliable way to mark decorative embedded content.

The accessible name should describe the purpose or content of the embedded resource. Testing that the name is actually descriptive is a separate concern from whether a name exists at all, but both matter for a good user experience.

Examples

Failing: <object> with no accessible name

This <object> embeds an image but provides no text alternative. A screen reader user will not know what the image depicts.

<object data="/images/diagram.png" type="image/png"></object>

Failing: relying on fallback content

The text inside the <object> tags is only shown when the image fails to load. It is not used as the accessible name when the image renders successfully.

<object data="/images/diagram.png" type="image/png">
Architecture diagram
</object>

Passing: using aria-label

<object
data="/images/diagram.png"
type="image/png"
aria-label="Architecture diagram showing three service layers">
</object>

Passing: using aria-labelledby

<h2 id="diagram-heading">Architecture diagram</h2>
<object
data="/images/diagram.png"
type="image/png"
aria-labelledby="diagram-heading">
</object>

Passing: using title

<object
data="/media/intro.mp4"
type="video/mp4"
title="Introduction video for the onboarding course">
</object>

Passing: decorative object with a presentational role

When the embedded content is decorative and conveys no information, hide it from the accessibility tree with role="presentation" or role="none".

<object
data="/images/decorative-border.png"
type="image/png"
role="presentation">
</object>

Detect accessibility issues automatically

Rocket Validator scans your site with complementary accessibility engines, helping teams find issues across every page.

Help us improve our guides

Was this guide helpful?
๐ŸŒ Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial โ†’

Join teams across 40+ countries