What AuditX checks
The scan reads the lang value on the html tag of the page you scanned. A page counts as right to left when the language is one of ar, he (also written iw), fa, ur, yi, dv, ckb or ps. When the lang value has a four-letter script part, the script decides instead, and these scripts count: Arab, Hebr, Thaa, Syrc, Nkoo, Adlm and Rohg. When the page has no lang value, or the language is not right to left, the result is an info note, which does not lower the score. For a right-to-left page it reads the dir attribute on the html tag, or on the body tag when the html tag has none. It passes when the value is rtl or auto. It also passes when the top level has no dir value other than ltr and some element inside the body has dir="rtl". It warns in two cases: the top level says dir="ltr", or no dir="rtl" is found anywhere. The scan reads the page as fetched. It does not read CSS, so a stylesheet that mirrors the layout does not count. It does not look at how the page is drawn. A warning counts toward the technical score at 40 percent of what a fail would cost. This check cannot cap the overall score.
Why it matters
W3C says that if the overall document direction is right to left, you should add dir="rtl" to the html tag, and that no dir attribute means the default is left to right. It says direction should not be set with CSS.
MDN shows an Arabic paragraph with a lang attribute and no dir attribute, laid out left to right and marked as wrong in the example. A lang value tells browsers and screen readers the language, but it does not set the direction.
How to fix it
- Add dir="rtl" to the html tag of every page that is written right to left.
- Keep the lang value on the same tag, so the language and the direction are both stated.
- Use dir="auto" only on elements where the language varies, such as user comments.
- In a theme or multilingual plugin, look for a right-to-left setting instead of editing every template by hand.
<html lang="ar" dir="rtl">
Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.
Scan my site