This page is in progress -
Why This is Important
The correct language attribute ensures that screen readers process the content in the intended language.
Blind and visually impaired people use screen readers to interact with websites and apps. A screen reader is a type of assistive tech that converts things on screen to audio and/or braille. It's important that things are understandable and interactive to screen readers.
Keyboard accessibility is essential for people who do not use a computer mouse (which might be because they have unpredictable or very specific movement due to a motor disability). Many Blind and visually impaired people also use keyboard interactions in order to use their screen reader.
Error support is accessible to people with a diversity of disabilities. A cognitive disability might affect how a person perceives and understands things. A physical disability might lead to unpredictable movement. Other factors such as environment, stress, and multi-tasking may also lead to errors.
In order to be accessible, gestures and interactions must account for people with physical and motor disabilities, who might have unpredictable or very specific movement.
In order to ensure the screen reader user experiences content in the intended human language, the human language attribute must be correctly labeled.
This references WCAG criteria 3.1.1 Language of Page (Level A) and 3.1.2 Language of Parts (Level AA).
Level AAA compliance is considered more difficult to meet because it requires more resources to fulfill. It also might encompass conflicting access needs (meaning what is accessible to some might be inaccessible to others). Use your best judgment of your target audience and your team's capabilities to determine if this is a pragmatic goal to reach.
How to Implement This
Language of the Page
Add the language attribute to each page with the correct language code.
<html lang="en-US">
<p>It's a beautiful day to not wear pants.</p>
</html>
Language of Phrases and Passages
For individual phrases and passages that differ from the page language, use the span element.
<p>Hungarians refer to themselves as <span lang="hu">magyarok</span>.</p>
Note on "Programmatically Determined"
WCAG often uses the phrase "programmatically determined" to mean that an element is defined in markup (HTML) and therefore available for assistive tech to access. I use the term "defined in markup" instead because I find it more simple and understandable. Just keep this in mind when reading WCAG source material.
How to Test This
Use an automated testing tool such as Deque Axe or IBM Accessibility Checker to test for human language attribute.
Contribute and Give Feedback
If you would like to provide feedback or contribute content on this resource, please fill out the form below.