Accessibility

lang-attribute

Require a valid lang attribute on the <html> element.

Verifies that the document root carries a valid BCP-47 language tag. Missing lang attributes break screen-reader pronunciation and translation tools — and AI agents that scaffold a fresh layout file omit it most of the time.

Behavior

  • Fixable: Yes — adds lang="en" to the <html> tag.
  • Suggestions: Yes.
  • Maps to: WCAG 3.1.1 (Language of Page).

Examples

Bad:

<html>...</html>

Good:

<html lang="en">...</html>

Related rules

Use it

Enable lang-attribute in your eslint.config.js:

import deslint from '@deslint/eslint-plugin';

export default [
  {
    plugins: { deslint },
    rules: {
      'deslint/lang-attribute': 'error',
    },
  },
];

Found a false positive? Report it on GitHub →

Back to all rules