Skip to content

Add RTL support for chat messages#1484

Open
gurfi1 wants to merge 5 commits intopingdotgg:mainfrom
gurfi1:main
Open

Add RTL support for chat messages#1484
gurfi1 wants to merge 5 commits intopingdotgg:mainfrom
gurfi1:main

Conversation

@gurfi1
Copy link
Copy Markdown

@gurfi1 gurfi1 commented Mar 28, 2026

What Changed

Added dir="auto" to message text containers in both user and assistant messages:

  • UserMessageBody in MessagesTimeline.tsx (all 3 text rendering paths)
  • ChatMarkdown wrapper div in ChatMarkdown.tsx

Before:

image

After:

image

Here's a video explaining the changes:

t3code-pr-video.mp4

Why

Messages in RTL languages (Arabic, Hebrew, Persian, etc.) displayed with incorrect LTR alignment, making them hard to read. The HTML dir="auto" attribute uses the browser's built-in Unicode Bidi Algorithm to detect the first strong directional character and set text direction automatically - no custom detection logic needed. LTR messages are unaffected.

Checklist

  • Changes are minimal and focused

  • No new dependencies added

  • Works for both web and desktop (shared components)

  • This PR is small and focused

  • I explained what changed and why

  • I included before/after screenshots for any UI changes

  • I included a video for animation/interaction changes


Note

Low Risk
Low risk UI-only change that relies on browser dir="auto" behavior; potential issues are limited to chat text layout in edge cases.

Overview
Improves RTL rendering in chat by adding dir="auto" to key message text containers, including user message bodies (MessagesTimeline.tsx) and common markdown block elements (ChatMarkdown.tsx).

Updates chat markdown styling to use logical CSS properties (padding-inline-start, border-inline-start) so list indentation and blockquote borders adapt correctly to LTR/RTL direction.

Written by Cursor Bugbot for commit 0d33c10. This will update automatically on new commits. Configure here.

Note

Add RTL support for chat messages using dir="auto"

  • Adds dir="auto" to block-level elements (p, headings, li, blockquote) in ChatMarkdown.tsx, letting the browser detect text direction per element.
  • Adds dir="auto" to user message body containers in MessagesTimeline.tsx.
  • Replaces padding-left/border-left with logical CSS properties (padding-inline-start, border-inline-start) in index.css so list and blockquote styles adapt to writing direction.

Macroscope summarized 0d33c10.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e41c9b36-520e-4f97-8d88-b0c85546ce3d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@juliusmarminge juliusmarminge enabled auto-merge (squash) March 28, 2026 17:26
Use dir="auto" on user and assistant message text containers so the
browser automatically detects RTL languages (Arabic, Hebrew, etc.)
and aligns text correctly.
auto-merge was automatically disabled March 29, 2026 01:50

Head branch was pushed to by a user without write access

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Mar 29, 2026
Move dir="auto" from the outer ChatMarkdown wrapper to individual
text-level markdown components (p, headings, li, blockquote) so
code blocks, Shiki-highlighted code, and tables remain LTR.
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Replace physical border-left/padding-left with border-inline-start/
padding-inline-start so blockquote borders and list indentation follow
text direction in RTL content.
@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants