HTML page language is valid

  • Rule Typeatomic
  • Rule ID: bf051a
  • Last modified: Sep 25, 2019
  • Accessibility Requirements Mapping
    • 3.1.1 Language of Page (Level: A)
      • Learn More about 3.1.1 (Language of Page)
      • Required for conformance to WCAG 2.0 and above on level A and above.
      • Outcome mapping:
        • Any failed outcomes: not satisfied.
        • All passed outcomes: further testing needed.
        • An inapplicable outcome: further testing needed.
  • Input Aspects


This rule checks that the lang attribute of the root element of an HTML page has a valid primary language subtag.


This rule applies to any document element if it is an html element that:

Note: html elements within iframe and object elements are not applicable as iframe and object elements create nested browsing contexts. However, as these elements are meant to provide a layer of isolation, the declared language of their parent browsing context will likely not be inherited, making it possible for non-valid lang attributes in nested browsing contexts to also cause accessibility issues.


For each test target, the lang attribute has a valid language subtag.


This rule assumes that the presence of a lang attribute is being used to comply to WCAG. This rule doesn't test if the attribute is needed to comply to WCAG.

Accessibility Support

There are no major accessibility support issues known for this rule.


Test Cases


Passed Example 1

The lang attribute specified is neither empty ("") nor only ASCII whitespace and has a valid primary language subtag.

<html lang="fr"></html>


Failed Example 1

The lang attribute value is not a valid primary language subtag.

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

Failed Example 2

The lang attribute value has a valid primary language subtag, but a syntactically invalid region subtag.

<html lang="en-US-GB"></html>

Failed Example 3

The lang attribute value is not a valid primary language subtag.

<html lang="123"></html>

Failed Example 4

The lang attribute value is not a valid primary language subtag.

<html lang="#!"></html>


Inapplicable Example 1

The rule does not apply to svg elements.

<svg xmlns="" lang="fr"></svg>



key: outcome

A conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

  • Inapplicable: No part of the test subject matches the applicability
  • Passed: A test target meets all expectations
  • Failed: A test target does not meet all expectations

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementers using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such "interim" results can be expressed with the incomplete outcome.

Useful Links


Tool NameCreated ByReport
AlfaSiteimproveView Report
RGAA 3.0Access42View Report


Table of Contents