Skip to main content
Checks that the html lang attribute has a valid language code
Rule IDa11y/html-lang-valid
CategoryAccessibility
ScopePer-page
Severityerror
Weight7/10

Solution

The lang attribute on <html> should be a valid BCP 47 language tag. Use two-letter ISO 639-1 codes like ‘en’ for English, ‘es’ for Spanish, ‘fr’ for French. You can add region subtags like ‘en-US’ or ‘en-GB’. This helps screen readers use correct pronunciation.

Enable / Disable

Disable this rule

squirrel.toml
[rules]
disable = ["a11y/html-lang-valid"]

Disable all Accessibility rules

squirrel.toml
[rules]
disable = ["a11y/*"]

Enable only this rule

squirrel.toml
[rules]
enable = ["a11y/html-lang-valid"]
disable = ["*"]