object-alt
Make sure that <object>
elements contain alternative text.
Description
The <object>
HTML element serves various purposes such as displaying images, embedding browsing contexts, or handling plugins. To ensure accessibility, it is important to provide a text alternative for the <object>
element so that screen reader users can understand its content.
This text alternative, known as an accessible name, should accurately describe the contents of the <object>
. However, if the <object>
element is purely presentational and doesn’t require accessibility, you can use role="none"
or role="presentation"
to remove it from the accessibility tree.
Why is it important?
Screen readers rely on alternative text to convey the meaning of non-text content to users, as they are unable to directly interpret such content. When it comes to embedded object elements, it is crucial to provide short and descriptive alternative text. This ensures that screen reader users can obtain the information contained within these elements.
The alternative text should accurately convey the intent, purpose, and meaning of the object, allowing assistive technologies to effectively communicate it to users.
How to fix?
Each <object>
element can be provided alternative text using one of these methods:
- Adding inner text
- An
aria-labelledby
attribute that references elements that are visible to screen readers. - A non-empty
title
attribute - A non-empty
aria-label
attribute - Override the role of the element as role=”none” or role=”presentation”
References
- WCAG 1.1.1: Non-text Content
- Technique 53: Using the body of the object element
- Accessibility Insights: object-alt
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!