HTML elements with lang and xml:lang must have the same base language

Moderate

What is the problem?

The html-xml-lang-mismatch rule occurs when the lang and xml:lang attributes on an HTML element specify different languages.

Impacted Groups

Blind
Deafblind
Cognitive

Why is this important?

Inconsistent language attributes can confuse assistive technologies and users, especially those who rely on language-specific features like screen readers and translation tools. This can lead to a poorer user experience and hinder accessibility.

How to solve this issue

To fix this issue, ensure that both the lang and xml:lang attributes on the <html> element specify the same language code. This consistency will help assistive technologies correctly interpret the content and provide appropriate language-specific support.

Rule Information

Rule ID

html-xml-lang-mismatch

Severity

Moderate

Manual Review Required

No

Rule Group

WCAG 2.0 Level A & AA Rules

Guidelines

  • WCAG 2.1 (A)
  • WCAG 2.0 (A)
  • WCAG 2.2 (A)
  • EN 301 549

Customise Guidance

You can customise each accessibility rule in SiteAlly with your own guidance, instructions and even links to your own organisation specific documentation.

Enable your website editors to resolve issues quickly with SiteAlly.

Ready to make your website accessible?

SiteAlly provides automated accessibility monitoring, detailed reports, and step-by-step guidance to help you achieve and maintain compliance.