SIA-R5<html> document elements have a valid lang attribute

Accessibility requirements

This rule tests conformance of the following accessibility requirements:

Description

This rule checks that document elements have a lang attribute that is valid.

Applicability

This rule applies to every lang attribute that is neither empty nor only ASCII whitespace and is declared on a document element which is an <html> element in the HTML namespace and in a top-level browsing context.

Expectations

  1. The value of the target attribute is a valid language tag.

Assumptions

This rule makes no assumptions.

Accessibility support

This rule has the following accessibility support concern:

Examples

Passed

This lang attribute has a value that is a valid language tag and therefore passes the rule:

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

Failed

This lang attribute has a value that is not a valid language tag and therefore fails the rule:

<html lang="xyz"></html>

Inapplicable

This lang attribute has a value that is empty and is therefore inapplicable:

<html lang=""></html>

This lang attribute has a value that is only ASCII whitespace and is therefore inapplicable:

<html lang=" "></html>

Acknowledgments

This document includes material copied from or derived from https://www.w3.org/WAI/standards-guidelines/act/rules/bf051a/. Copyright © 2024 W3C® (MIT, ERCIM, Keio, Beihang).