useHtmlLang
Diagnostic Category: lint/a11y/useHtmlLang
Since: v1.0.0
Sources:
- Same as:
jsx-a11y/html-has-lang
Enforce that html
element has lang
attribute.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.jsx:1:1 lint/a11y/useHtmlLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a lang attribute when using the html element.
> 1 │ <html></html>
│ ^^^^^^
2 │
ℹ Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
code-block.jsx:1:1 lint/a11y/useHtmlLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a lang attribute when using the html element.
> 1 │ <html lang={""}></html>
│ ^^^^^^^^^^^^^^^^
2 │
ℹ Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
code-block.jsx:1:1 lint/a11y/useHtmlLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a lang attribute when using the html element.
> 1 │ <html lang={null}></html>
│ ^^^^^^^^^^^^^^^^^^
2 │
ℹ Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
code-block.jsx:1:1 lint/a11y/useHtmlLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a lang attribute when using the html element.
> 1 │ <html lang={undefined}></html>
│ ^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
code-block.jsx:1:1 lint/a11y/useHtmlLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a lang attribute when using the html element.
> 1 │ <html lang={true}></html>
│ ^^^^^^^^^^^^^^^^^^
2 │
ℹ Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.