Skip to content

fix(web): add bidirectional text support for RTL languages#2128

Open
darkyeg wants to merge 6 commits intopingdotgg:mainfrom
darkyeg:fix/bidi-text-direction
Open

fix(web): add bidirectional text support for RTL languages#2128
darkyeg wants to merge 6 commits intopingdotgg:mainfrom
darkyeg:fix/bidi-text-direction

Conversation

@darkyeg
Copy link
Copy Markdown

@darkyeg darkyeg commented Apr 17, 2026

What Changed

  • Added dir="auto" and unicode-bidi: plaintext to chat messages,
    composer, question panels, thread titles, plan sidebar, and
    plan cards
  • Replaced margin-left, text-left, border-left with logical
    properties (text-start, gap-x, border-inline-start)
  • Code blocks and tables isolated as LTR so they don't flip

Why

RTL text like Arabic and Hebrew was unreadable when mixed with
English. Punctuation jumping around, words in wrong order.
dir="auto" lets the browser figure out direction per element
from the first strong character, which is the standard fix for this.

Addresses #1771

UI Changes

Before

before.mp4

After

after.mp4

Checklist

  • 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
Primarily presentational changes (dir attributes and CSS logical properties) with minimal behavioral impact; main risk is small layout/regression in text alignment or markdown rendering.

Overview
Improves RTL/mixed-direction readability across the chat UI by adding dir="auto" to key text containers (chat markdown, user messages, composer editor, thread/plan titles, and plan/question panels) so browsers auto-detect direction per element.

Updates global styles to better handle bidirectional content via unicode-bidi: plaintext, switches several left/right-specific rules to logical properties (padding-inline-start, border-inline-start, text-align: start, text-start), and explicitly keeps pre/code/table content LTR to avoid flipped code/table rendering.

Reviewed by Cursor Bugbot for commit d1fd51c. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

[!NOTE]

Add bidirectional text support for RTL languages across chat and sidebar components

  • Adds dir="auto" to user message text, chat markdown, composer input, thread titles, plan titles, and archived thread headings so browsers auto-detect RTL/LTR direction per element.
  • Updates index.css with unicode-bidi: plaintext for paragraph-level direction detection and logical CSS properties (padding-inline-start, border-inline-start, text-align: start) to respect RTL layouts.
  • Forces LTR direction on pre/code/table blocks inside chat markdown to preserve code readability.
  • Replaces text-left with text-start on option and plan buttons so alignment is logical in both LTR and RTL contexts.

Macroscope summarized d1fd51c.

Chat messages with RTL languages (Arabic, Hebrew, Persian) rendered
incorrectly because the browser defaulted to LTR with no direction
hints, causing text and punctuation to appear in the wrong order.

Apply dir="auto" and unicode-bidi: plaintext so each line and block
element detects its base direction from its first strong character.
Code blocks and tables are isolated as LTR to preserve their layout.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 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: 711d15be-96a8-4e0a-805d-6763bca4ca97

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.

@github-actions github-actions bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 17, 2026
Comment thread apps/web/src/index.css
Comment thread apps/web/src/index.css
Replace padding-left and border-left with padding-inline-start and
border-inline-start on lists and blockquotes so they flip correctly
in RTL. Use text-align: start instead of left on table cells. Replace
data-testid selector with a dedicated class for the composer bidi rule.
macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 17, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 17, 2026

Approvability

Verdict: Approved

Purely presentational changes adding RTL language support via standard HTML dir="auto" attributes and CSS logical properties. No backend logic, API changes, or runtime behavior modifications - only text rendering direction is affected.

You can customize Macroscope's approvability policy. Learn more.

darkyeg added 2 commits April 17, 2026 19:34
Card inherits direction from header language via dir="auto", question
text and option labels/descriptions each resolve their own direction
independently. Uses logical CSS properties (text-start, gap-x-2)
instead of physical ones for correct RTL layout.
Add dir="auto" to thread title rendering in header, sidebar, and
settings archive. Add bidi support to plan sidebar (explanation,
steps, plan title) and proposed plan card/banner. Use text-start
logical property in plan sidebar expand button.
@macroscopeapp macroscopeapp bot dismissed their stale review April 17, 2026 18:31

Dismissing prior approval to re-evaluate e2f066b

@darkyeg darkyeg changed the title fix(web): add bidirectional text support for RTL chat content fix(web): add bidirectional text support for RTL languages Apr 17, 2026
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.

Reviewed by Cursor Bugbot for commit e2f066b. Configure here.

Comment thread apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx Outdated
…lements only

Remove dir="auto" from the outer question panel wrapper to avoid
reversing flex layouts for shortcut keys and status indicators.
The inner text elements (question, labels, descriptions) already
have their own dir="auto" which handles text direction correctly.
Also includes formatting fixes from bun fmt.
@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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.

1 participant