Skip to content

fix(rtl): auto-detect text direction in read, print and plain-text views#663

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/read-view-auto-direction
Open

fix(rtl): auto-detect text direction in read, print and plain-text views#663
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/read-view-auto-direction

Conversation

@shukiv

@shukiv shukiv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

The reader renders message bodies with the UI's direction, not the message's. With an RTL UI (Hebrew/Arabic/Persian), an English email is right-aligned; with an LTR UI, a Hebrew email is left-aligned. Mixed-language mail is wrong either way.

Fix

Add dir="auto" in the three places a message body is rendered:

  • the sandboxed HTML iframe body
  • the print view body
  • the plain-text render container

auto resolves direction per block from its first strong character, so each paragraph aligns by its own content — an English paragraph stays LTR even inside an RTL UI, and vice-versa. Mixed-language messages render each block correctly.

Three attributes, no logic or dependency changes; LTR-only mail is unaffected (auto resolves to LTR).

Testing

  • Hebrew email in an English UI → right-aligned ✅
  • English email in a Hebrew UI → left-aligned ✅
  • Mixed Hebrew/English message → each paragraph aligned by its own content ✅
  • Plain-text and print views match the HTML view ✅
  • tsc clean; lint clean (no new warnings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant