<html> element has an [xml:lang] attribute with the same base language as the [lang] attribute

The page's language setting is consistent so screen readers pronounce content correctly.

On this page

Impact

ScanGov impact ratings

About

If the webpage does not specify a consistent language, then the screen reader might not announce the page's text correctly.

Risks

Screen readers mispronounce content, confusing users.

Why it's important

Helps screen readers pronounce content correctly by identifying the language of the page and its elements.

User stories

As a screen reader user, I want the page language to be correctly identified so that content is pronounced properly.

Code

Failing pattern:

<!-- Fail: lang and xml:lang do not match -->
<html lang="en" xml:lang="fr">

Passing pattern:

<!-- Pass: values match -->
<html lang="en" xml:lang="en">

Error

ScanGov messaging when a site fails a standard:

Failed: <html> element has an [xml:lang] attribute with the same base language as the [lang] attribute

Guidance

Indicators

On this page