Accessibility
Modern browsers have very good accessibility support for iframes, and this can be further enhanced
to aid users navigating with assistive technology, such as screen readers, by using the
title attribute on an
<iframe>
to label its contained content.
Having a title
attribute allows screen readers to announce the purpose of the iframe without
requiring users to navigate into it. This saves time and reduces confusion, especially on pages
with multiple <iframe>
elements or interactive content like video or audio.
Automated Title Attribute
Section titled “Automated Title Attribute”Where iframes are missing the title
attribute, iframe-resizer will automatically set it using
the text contained within the <title>
element of the iframe’s content. This ensures the title
attribute is always up to date and accurately reflects the page currently displayed within the iframe.
For example:
<!-- Without title --><iframe src="example.html"></iframe>
<!-- With title --><iframe src="example.html" title="Example Content"></iframe>
By automating this process, iframe-resizer ensures that your iframes are accessible without requiring additional manual effort.