Language Attribute Check
Description
The “Language Attribute Check” evaluates whether all HTML elements using the lang
attribute declare a valid BCP 47 language tag.
Example outcome
I noticed that all elements with a lang attribute use a valid language tag.
Impact
- Visual Impairments: Screen readers may mispronounce words, especially in multilingual content. Misinterpretation of tone or meaning (e.g., a French word read with an English voice).
- Cognitive Disabilities: Mismatch between expected language and how content is read or displayed can cause confusion, increase cognitive load, or hinder comprehension.
Fixes
To address inappropriate or missing lang
attributes:
- Locate the HTML element missing or with an inappropriate language attribute.
- If missing, add a
lang
attribute to HTML elements that contain text in a language different from the document’s default. - Make sure the tag uses a valid language code.