htmlLangs
Reports <html> elements without a lang prop.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
The lang attribute on the <html> element identifies the language of the document for screen readers and assistive technologies.
Without it, screen readers may default to the user’s system language, causing confusion for users.
This is required for WCAG 3.1.1 compliance.
Examples
Section titled “Examples”<any
html> <any
body>Content</any
body></any
html><any
html className: string
className="root"> <any
body>Content</any
body></any
html><any
html lang: string
lang="en"> <any
body>Content</any
body></any
html><any
html lang: string
lang="en-US"> <any
body>Content</any
body></any
html><any
html lang: string
lang={const language: string
language}> <any
body>Content</any
body></any
html>;When Not To Use It
Section titled “When Not To Use It”If you’re not working with HTML documents or the <html> element is managed by a framework, you can disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/html-has-lang - Oxlint:
jsx_a11y/html-has-lang
Made with ❤️🔥 around the world by
the Flint team and contributors.