Mixed-Direction Text Handling
Right-to-left scripts (Arabic, Hebrew) and LTR scripts (Latin, CJK) often meet inline. <bdi> isolates a bidirectional run from its surroundings; <bdo dir="..."> forces a direction override when the algorithm gets it wrong.
User Reviews (mixed names)
- يوسف احمد — ⭐⭐⭐⭐⭐ "Fast delivery, great packaging."
- משה כהן — ⭐⭐⭐⭐ "Exactly as described, will buy again."
- 山田太郎 — ⭐⭐⭐⭐⭐ "Prompt shipping, item in perfect condition."
- Olivia Rossi — ⭐⭐⭐ "Color slightly different from photo."
Without <bdi>, some Latin-named reviews might get misaligned because the browser sees the preceding RTL text and reorders punctuation.
Forced Override (<bdo>)
A Palestinian Arabic brand that uses Latin words in its logo: Café NOOR — قهوة النور
Hebrew phrase embedded in an LTR context — the date ordering flips if we force RTL: Order #4291 · 15/02/2024 · Shipping confirmed
When to use which
| Element | When | Attribute |
|---|---|---|
<bdi> |
Content direction unknown ahead of time (usernames, forum posts) | none (auto-isolate) |
<bdo> |
Browser's bidirectional algorithm got it wrong; you know the correct direction | dir="rtl" or dir="ltr" |
Rule of thumb: try <bdi> first — it works with the browser's algorithm rather than against it. Reach for <bdo> only when the visual order is genuinely broken and you can't fix it any other way.