WCAG 2.1 Level AA (iframe-lang rule)
This article covers iframe-lang rule. WCAG provides general principles and criteria to ensure that web content is accessible to a wide range of users, including those with disabilities.
For language-related considerations within iframes, the following general guidelines apply:
- Lang Attribute: Use the
langattribute on the<html>element within the iframe to declare the language of the content. This is important for screen readers and other assistive technologies to correctly pronounce or interpret the content.<iframe src="example.html"> <html lang="en"> <!-- Content of the iframe goes here --> </html> </iframe> - Explicit Language Declaration:
- Explicitly declare the language of the iframe content even if the language is the same as the surrounding content. This helps ensure that assistive technologies accurately interpret the language.
- Content Language Consideration: If the content within the iframe is in a different language, set the
langattribute accordingly.<iframe src="example-fr.html"> <html lang="fr"> <!-- Content of the iframe is in French --> </html> </iframe> - Screen Reader Testing:
- Test the iframe with screen readers to verify that the language is announced correctly and that users can understand and navigate the content.
While WCAG doesn’t explicitly mention an “iframe-lang” rule, these practices contribute to meeting broader accessibility criteria related to language and content presentation. Keep in mind that accessibility is a holistic consideration, and addressing language-related concerns within iframes is just one aspect of creating an inclusive digital experience.
WCAG 2.1 Level AAA
For language-related considerations within iframes at the AAA level, you can follow similar guidelines as mentioned for WCAG AA compliance.

