- Success Criterion 3.1.1
- Conformance level A
Language Switcher That Doesn’t Update the Page’s Lang Attribute
3.1.1 — Language of Page
Scenario
Setting
A hospital's patient portal appointment scheduler
What’s wrong
single-page app localization switching UI language without updating document.documentElement.lang.
Example
A QA pass on a hospital's patient portal appointment scheduler turns this up: single-page app localization switching UI language without updating document.documentElement.lang.
Why it matters
Screen-reader users who need correct pronunciation, and tools that depend on language metadata. On a hospital's patient portal appointment scheduler specifically, they can't tell what language they're reading.
How to test
Switch the site's UI language and check document.documentElement.lang in DevTools console: if it doesn't update to match, it fails.
How to fix
The <html> element must carry a valid lang attribute matching the page language, updated when the site language switches.
Outcome
Fixed, a visitor to a hospital's patient portal appointment scheduler can understand which language they're reading.
Who is affected
Screen-reader users who need correct pronunciation, and tools that depend on language metadata.
Learn more
- Understanding Understanding document (opens in a new tab)
Related scenarios
- Page Published With No Language Declared in the Code
- HTML Element Missing Its Language Attribute Entirely
- Page’s Declared Language Not Matching Its Actual Content
- Language Attribute Set to an Invalid or Malformed Value
- Language Attribute Set on the Body Instead of the HTML Root
- Multilingual Site Serving Every Locale With the Same Lang Value