iFrame needs title attribute
Framed content (iframe & frame elements) require a title attribute to describe the content. "This provides a label for the frame so users [of assistive technology] can determine which frame to enter and explore in detail."
WCAG 2.4.1 Bypass Blocks: A mechanism is available to bypass blocks of content that are repeated on multiple Web pages. (Level A)
There are 5 instances on the amp-iframe page https://ampbyexample.com/components/amp-iframe/
Code example:
<iframe class="i-amphtml-fill-content -amp-fill-content" name="amp_iframe0" allowfullscreen="" frameborder="0" sandbox="allow-scripts allow-same-origin allow-popups" src="https://player.vimeo.com/video/140261016#amp=1"></iframe>
Suggested code:
<iframe title="Netflix Branding: The Stack" class="i-amphtml-fill-content -amp-fill-content" name="amp_iframe0" allowfullscreen="" frameborder="0" sandbox="allow-scripts allow-same-origin allow-popups" src="https://player.vimeo.com/video/140261016#amp=1"></iframe>
References: https://www.w3.org/TR/2016/NOTE-UNDERSTANDING-WCAG20-20161007/navigation-mechanisms-skip.html https://www.w3.org/TR/WCAG20-TECHS/H64.html
Question - looking at the amp-iframe page and Github repo code, is this issue regarding adding a title attribute to the examples?
For example:
# current code
<amp-iframe width="500" height="281"
layout="responsive"
sandbox="allow-scripts allow-same-origin allow-popups"
allowfullscreen
frameborder="0"
src="https://player.vimeo.com/video/140261016">
</amp-iframe>
# Suggested change
<amp-iframe width="500" height="281"
title="Netflix Branding: The Stack"
layout="responsive"
sandbox="allow-scripts allow-same-origin allow-popups"
allowfullscreen
frameborder="0"
src="https://player.vimeo.com/video/140261016">
</amp-iframe>
I do not see the title attribute listed in the amp-iframe docs or the common attributes reference list.
Can @aghassemi or @kul3r4 confirm if the title attribute is available? I can update all examples once confirmed!
The title attribute is supported (tip: the playground is a quick way to check this). We should update the samples (there are probably other amp-iframe uses in the code base as well). Lisa, if you want to take a look that'd be fantastic!
Yes, please add title to examples as well as documentation. Thank you.
Updated samples on Amp By Example page and submitted PR #952 .
To update reference documentation, it looks like I should be updating docs in amphtml instead of ampproject docs directly?
The docs in the reference section of the AMP Project site are not part of this repository; instead they are read from the amphtml GitHub repository "source of truth."
Thanks for the PR. Regarding the reference docs, you're right, these need to be updated in the amphtml repository (this is the file for the amp-iframe docs).
Went through codebase and updated all repos with <amp-iframe> examples, see PR listed above.
Commented on outstanding issues #440 and #656 (which is merged, but this repo Hotel is not added to AMP By Example - Samples & Templates page yet.)
@lisaychuang Awesome! Thanks a lot for going through the efforts of fixing all these!
I see the title attribute in the documentation and the amp-iframe element, thank you. But in the final rendered markup, the title attribute remains on the on amp-iframe element, not the actual iframe.
The title attribute must be on the child iframe element (which has the video) not on the amp-iframe. I tested in Voiceover and confirmed that it's not working correctly.
I'm experiencing the same behavior as @weboverhauls. Is there a way for the amp-iframe element to set the title on the actual iframe or is there some other workaround?
Lighthouse flags it as an accessibility issue.
I thought the title would apply to the child iframe element as well, but I'm getting the same lighthouse flag as @lesleslie since it's applying only to the amp-iframe element. Is there an upcoming solution?