html-xml-lang-mismatch

lang and xml:lang must not disagree

automaticWCAG 3.1.1 (A)confidence: highseverity: seriousunderstandable

Checks that the <html> element's lang and xml:lang attributes declare the same primary language, when both are present.

Applies to. Applies when the <html> element has both a non-empty lang attribute and a non-empty xml:lang attribute.

Expectation. The primary language subtag (the part before the first "-") of lang and xml:lang match, case-insensitively. When both attributes are present but declare different languages, assistive technology and user agents may resolve the page's language inconsistently.

Examples

pass
<html lang="en-US" xml:lang="en-GB">

Primary subtags agree (`en`); regional subtags are allowed to differ.

fail
<html lang="en" xml:lang="fr">

`lang` and `xml:lang` declare different primary languages.

View source