Title attribute, if video published in an <iframe>
The HTML title
attribute lets people using a screen reader know that a video is present and what it’s about, so that they can play it or skip past it if they want to.
Remember to add a title
attribute to each video embedded using an <iframe>
.
If publishing a video from YouTube, Vimeo or another video-sharing platform, the video will most likely be embedded in the web page using an <iframe>
element.
Meeting the Web Accessibility Standard
WCAG’s Success Criterion 4.1.2 Name, Role, Value requires that every user interface component have an accessible name that assistive technologies can use to refer to it. For a video embedded in an <iframe>
, the title
attribute provides the name. For more on accessible names, see the Knowledge Area: Accessible names and descriptions.
There is some disagreement among accessibility experts about whether or not an <iframe>
meets the definition of a user interface component — and therefore if Success Criterion 4.1.2 applies to <iframe>
elements.
However, a descriptive title
attribute on a video <iframe>
helps screen reader users and does no harm, so it remains recommended practice.
How a title
attribute makes a video more accessible
By giving the <iframe>
a title
attribute that has a short, meaningful description, people using assistive technologies like screen readers can identify the content or purpose of the <iframe>
. In the case of a video embedded in an <iframe>
, they will understand that the content in the <iframe>
is a video and what the video is about. This allows them to interact with or skip past the video as they please.
How to create a title
attribute for a video <iframe>
Modify the HTML <iframe>
code to include an appropriate title
attribute that has a short meaningful description.
In the example above, the opening <iframe>
tag has this title
attribute value: “YouTube video about human rights — presented in New Zealand Sign Language”.
Read more about adding title
attributes for videos published in an <iframe>
: H64: Using the title
attribute of the frame
and iframe
elements — W3C.