html-lang-attr-present

Page language is declared

automaticWCAG 3.1.1 (A)confidence: highseverity: seriousunderstandable

Checks that the default language of the page is programmatically declared.

Applies to. Applies to HTML documents with a root <html> element. The rule evaluates the document element only and does not iterate over child nodes. Non-HTML documents or documents without a document element are not applicable.

Expectation. The <html> element has a lang attribute. The lang attribute is not empty and contains a syntactically valid language tag.

Examples

pass
<html lang="en">
<head><title>Page title</title></head>
<body>Hi</body>
</html>

A non-empty, syntactically valid language tag is declared.

fail
<html>
<head><title>Page title</title></head>
<body>Hi</body>
</html>

No `lang` attribute at all on `<html>`.

View source