id | name | description | success_criterion | test_aspects | authors | ||||
---|---|---|---|---|---|---|---|---|---|
bf051a |
Validity of HTML Lang attribute |
This rule checks the lang or xml:lang attribute has a valid language subtag.
|
|
|
|
The root element of the page, if it is an html
element with a non-empty lang
and/or xml:lang
attribute.
The lang
and xml:lang
attributes have a valid language subtag if the attribute is non-empty.
There are currently no assumptions
There are known combinations of a popular operating system with browsers and assistive technologies that do not support the lang
and xml:lang
attributes.
While HTML5 specification indicates that xml:lang
attribute takes priority over lang
attribute, certain assistive technologies prioritise lang
over xml:lang
instead.
- https://www.w3.org/TR/2014/NOTE-WCAG20-TECHS-20140408/H57
- https://www.ietf.org/rfc/bcp/bcp47.txt
- https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
- https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xml:lang
- https://www.w3.org/TR/WCAG20-TECHS/H57.html
The lang
attribute specified has a non-empty value & a valid primary language subtag.
<html lang="fr"></html>
The xml:lang
attribute specified has a non-empty value & a valid primary language subtag.
<html xml:lang="fr"></html>
The lang
and xml:lang
attribute specified has a non-empty value & a valid primary language subtag.
<html xml:lang="fr" lang="fr"></html>
The lang
attribute specified has a non-empty value & a valid primary language subtag. The rule checks for the presence of either lang
or xml:lang
. Empty value specified for the other attribute is ignored.
<html lang="fr" xml:lang=""></html>
The xml:lang
attribute specified has a non-empty value & a valid primary language subtag. The rule checks for the presence of either lang
or xml:lang
. Empty value specified for the other attribute is ignored.
<html lang="" xml:lang="nl"></html>
The lang
attribute value is not a valid primary language subtag.
<html lang="xyz"></html>
The xml:lang
attribute value is not a valid primary language subtag.
<html xml:lang="xyz"></html>
Both the lang
and xml:lang
value specified are not valid values for primary language subtag.
<html xml:lang="xyz" lang="xyz"></html>
The lang
attribute value has a valid primary language subtag, but a syntactically invalid region subtag.
<html lang="en-US-GB"></html>
The rule applies to html
element and hence usage of lang
attribute in svg
element is not applicable.
<svg xmlns="http://www.w3.org/2000/svg" lang="fr">
The rule applies to html
element and hence usage of xml:lang
attribute in svg
element is not applicable.
<svg xmlns="http://www.w3.org/2000/svg" xml:lang="fr">
An empty value for lang
attribute is ignored by this rule, as the applicability specifies only non-empty values.
<html lang=""></html>
An empty value for xml:lang
attribute is ignored by this rule, as the applicability specifies only non-empty values.
<html xml:lang=""></html>