html-has-lang · WCAG 3.1.1 Language of Page · Level AHow to fix the “html-has-lang” accessibility issue
The axe-core html-has-lang rule fails when the root <html> element has no lang attribute. Without it, screen readers cannot pick the correct pronunciation engine. WCAG 2.2 (3.1.1, Level A) requires the page language to be programmatically set.
What axe-core checks
axe-core fails when <html> has no lang (or an empty one). A companion rule, html-lang-valid, checks the value is a valid BCP-47 code such as de or en.
Which standard this maps to
| WCAG 2.2 | 3.1.1 Language of Page (Level A) |
| EN 301 549 | 9.3.1.1 |
| BFSG / EAA | BFSG § 12 via EN 301 549 · EAA Annex I |
| Category | Language |
Why it matters
On a German shop without lang="de", a screen reader may read German text with English phonetics — unintelligible. It is a one-line fix, so leaving it unfixed reads as plain neglect in a BFSG assessment.
Common causes
<html>with nolangat all- A hard-coded
lang="en"on German pages - Invalid values like
lang="german"instead ofde - Locale not propagated by the CMS/template
How to fix it
Set lang on the <html> element to the page's primary language, using a valid BCP-47 code.
<!-- Fails -->
<html>
<!-- Passes (German page) -->
<html lang="de">
FAQ
A valid BCP-47 code: "de" for German, "en" for English, "de-AT" for Austrian German if needed.
Yes — set lang on the <html> for the page, and add lang on individual elements that switch language.
Find every issue like this on your site
Run a free WCAG 2.2 AA scan — real axe-core engine, no signup. Or get a timestamped evidence report for €29.