squirrelscan
GitHub

HTML Lang Valid

Checks that the html lang attribute has a valid language code

Checks that the html lang attribute has a valid language code

Rule ID a11y/html-lang-valid
Category Accessibility
Scope Per-page
Severity error
Weight 7/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

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

Disable all Accessibility rules

[rules]
disable = ["a11y/*"]

Enable only this rule

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

Type to search…

↑↓ navigate↵ openesc close