How to fix: The page must declare its language
The <html> element needs a lang attribute so screen readers use the right pronunciation and voice for the content.
The fix
Add a lang attribute to the <html> element, e.g. <html lang="en">.
Who this affects
Someone running NVDA with a Dutch voice who opens an English page with no lang hears English words spoken with Dutch phonetics, which stops being decipherable after about a sentence. The synthesiser gets no signal to switch, so it keeps whatever language the user configured as their default. This affects every word on the page rather than one control, and it hits people who use text-to-speech for a reading or language disability as well as screen-reader users.
Before and after
<html>
<html lang="en">
Where this usually comes from
- A framework root layout whose html tag was hand-written without attributes, such as a Next.js app/layout.tsx or a Nuxt app.vue.
- A CMS theme that hard-codes <html> instead of printing the configured site language, so switching the site to German changes nothing.
- The language is declared only in <meta http-equiv="content-language"> or an og:locale tag, neither of which assistive technology reads for the page language.
- A JavaScript-rendered shell that puts lang on <body> or a wrapper div, which does not satisfy the rule because it checks the root html element.
- The value is a country code or a display name, for example lang="US" or lang="english"; that passes html-has-lang and is reported by the separate html-lang-valid rule instead. Watch the codes that are both: lang="UK" declares Ukrainian, so it passes html-lang-valid as well and no scanner tells you the page is mislabelled.
Checking it yourself
Run document.documentElement.lang in the DevTools Console, or read the opening html tag in View Source. To hear the consequence, open NVDA Settings, go to Speech, and confirm "Automatic language switching (when supported)" is ticked; it is on by default. Then read a page written in a language other than your synthesiser's default: with lang present the voice changes, without it the words are read with the wrong phonetics.
A scanner finds this one automatically. What it cannot judge, and how the score is built, is on how we test.
Related fixes
Check your site for this issue
Scan any page free against WCAG 2.2 AA and get every automatically detected issue with its fix.