What it is
The lang attribute identifies language; dir and bidirectional markup establish reading direction for right-to-left and mixed-direction text.
Why it matters
Assistive technology chooses pronunciation from language. Bidirectional text can display punctuation, phone numbers, and embedded addresses in the wrong order without markup.
How to implement
Set lang and dir on the HTML root, override them for passages in another language, and use dir="auto" carefully for user-generated fragments.
Common mistakes
- Using text alignment instead of direction.
- Mirroring logos or media controls.
- Concatenating an LTR identifier into RTL text without isolation.
Verification
Read with a screen reader configured for each language and test mixed names, dates, prices, URLs, and phone numbers in RTL clients.