[Bug]: Assistant messages render Hebrew/Arabic text left-to-right (misaligned, punctuation at the wrong end, bullets on the left) #13622
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web
Steps to reproduce#
- Start a thread and ask a question in Hebrew (or Arabic), e.g.
תסביר לי בקצרה מה זה Device hub. - Let the assistant answer in Hebrew with normal markdown: a paragraph, a heading, a bullet list whose items mention English terms or inline code.
Expected behavior#
Each block of the assistant message (paragraph, heading, list, blockquote, table) takes the direction of its own content:
- Hebrew/Arabic blocks are right-aligned, bullets and list indentation sit on the right, and sentence punctuation stays at the end of the sentence.
- English blocks and code blocks stay left-to-right.
Actual behavior#
Assistant message bodies (.chat-markdown) always render with an LTR base direction:
- Hebrew paragraphs and headings are left-aligned.
- Trailing punctuation jumps to the start of the line (
לנייח.renders as.לנייח), and a line that starts or ends with an English word or inline code gets reordered. - Bullets and list indentation stay on the left.
.chat-markdown ul/olusepadding-leftandblockquoteusesborder-left/padding-left, so even setting a direction would not mirror them.
User messages look fine; only the rendered markdown of assistant replies is affected. For anyone working in an RTL language this affects every reply, and long answers are hard to read.
Impact#
Major degradation or frequent failure
Version or commit#
0.0.43-nightly.20260925.2237 (6391be272956)
Environment#
Windows 11 (26200), T3 Code desktop nightly, Claude Code provider
Notes#
This was scoped in #1771 ("Adopt logical Tailwind utilities so the renderer is bidi-ready", which explicitly listed "no bidi handling in message content"). That issue is closed as completed, but the two PRs that addressed it (#2128, #3674) were closed without merging, and the current nightly still has no direction handling in .chat-markdown. #4644 is the same problem in the preview annotation editor.
A note on the fix: plain dir="auto" (or unicode-bidi: plaintext) picks the direction from the first strong character. That misfires on the most common RTL case in this app, a Hebrew sentence that starts with an English term (**Device hub**: מאפשר ל...), which then renders LTR. Choosing the direction per top-level block by majority script (ignoring text inside code/pre) handles it, and list/blockquote spacing needs logical properties (padding-inline-start, border-inline-start) so it mirrors.
Workaround#
Locally I append a small script to the desktop preload that sets dir on each top-level .chat-markdown block by majority script (a MutationObserver keeps up with streaming) and flips the list and blockquote padding. It fixes rendering here, but app updates overwrite it.
I posted a comparison of the direction rules, with before/after screenshots in Hebrew, Arabic and Persian, in this comment on #16839. I offered to contribute there once maintainers confirm the intended rule and scope.
Yash-Singh1(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
https://github.com/pingdotgg/t3code/pull/16498