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
squirrel.toml
toml[rules]
disable = ["a11y/html-lang-valid"]Disable all Accessibility rules
squirrel.toml
toml[rules]
disable = ["a11y/*"]Enable only this rule
squirrel.toml
toml[rules]
enable = ["a11y/html-lang-valid"]
disable = ["*"]