html-xml-lang-mismatch

<html> elements with lang and xml:lang must have the same base language

Who might be affected
Screen Reader
Cognitive

Description

When using both lang and xml:lang attributes on the same element, the value of their language tag must be identical to ensure that screen readers read the content clearly and correctly.

Quick Fixes

Ensure that the values of the lang and xml:lang attributes is identical

1 <!DOCTYPE html>
2<html lang="en" xml:lang="en">
3 <!-- Page Content -->
4 </html>

In the example below, although the region code is different (i.e., “GB”, “US”) the primary language tag is still identical so the declared language is still considered identical.

1 <!DOCTYPE html>
2<html lang="en-GB" xml:lang="en-US">
3 <!-- Page Content -->
4 </html>
1 <!DOCTYPE html>
2<html lang="en" xml:lang="fr">
3 <!-- Page Content -->
4 </html>

How Users Are Affected

Screen readers may misread or mispronunciation parts of or the entire page.

WCAG Success criteria

This issue might cause elements to fail one or more of the following Success criteria:
3.1.1 Language of Page (A)