2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-04-28 16:49:39 +02:00
The ``++<html>++`` element should provide the ``++lang++`` and/or ``++xml:lang++`` attribute in order to identify the default language of a document.
It enables assistive technologies, such as screen readers, to provide a comfortable reading experience by adapting the pronunciation and accent to the language. It also helps braille translation software, telling it to switch the control codes for accented characters for instance.
2024-06-04 12:18:07 +02:00
Other benefits of marking the language include assisting user agents in providing dictionary definitions or helping users benefit from translation tools.
2021-04-28 16:49:39 +02:00
Both the ``++lang++`` and the ``++xml:lang++`` attributes can take only one value.
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,html]
2021-04-28 16:49:39 +02:00
----
<!DOCTYPE html>
<html> <!-- Noncompliant -->
<head>
<title>A page written in english</title>
<meta content="text/html; charset=utf-8" />
</head>
<body>
...
</body>
</html>
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,html]
2021-04-28 16:49:39 +02:00
----
<!DOCTYPE html>
<html lang="en">
<head>
<title>A page written in english</title>
<meta content="text/html; charset=utf-8" />
</head>
<body>
...
</body>
</html>
----
2022-02-04 17:28:24 +01:00
[source,html]
2021-04-28 16:49:39 +02:00
----
<!DOCTYPE html>
<html lang="en" xml:lang="en">
<head>
<title>A page written in english</title>
<meta content="text/html; charset=utf-8" />
</head>
<body>
...
</body>
</html>
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
== Resources
2021-04-28 16:49:39 +02:00
* https://www.w3.org/TR/WCAG20-TECHS/html.html#H57[WCAG2, H57] - Using language attributes on the html element
* https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0#qr-meaning-doc-lang-id[WCAG2, 3.1.1] - Language of Page
2021-04-28 18:08:03 +02:00
2021-09-20 15:38:42 +02:00
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Add "lang" and/or "xml:lang" attributes to this "<html>" element
=== Highlighting
Highlight the <html> element
2021-09-20 15:38:42 +02:00
endif::env-github,rspecator-view[]