HTML Language is missing a right-to-left direction directive
| Field | Value |
|---|---|
| Rule code | Html_Language_RightToleft_Missing |
| WCAG conformance level | A |
| WCAG success criterion | 1.3.2 Meaningful Sequence |
| Must be fixed at source | No |
Description
Some languages are read from right to left. When such a language is set via the lang attribute on the HTML tag, a supplementary dir (direction) attribute with a value of rtl (right to left) must be provided. Examples of languages that may require these directional directives are: Arabic (ar), Aramaic (arc), Dhivehi (dv), Persian (fa) and others. Using the direction attribute (dir) indicates that the content should be read in a specific direction and allows assistive technologies to read the content correctly.
How to fix
For right-to-left languages (Arabic, Aramaic, Divehi, Persian, Hausa, Hebrew, Khowar, Kashmiri, Kurdish, Pashto, Urdu, Yiddish), add dir="rtl" to the <html> tag alongside the lang attribute. For example, use <html lang="ar" dir="rtl"> for Arabic. This ensures correct text direction.