Skip to content

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

Closed
darkyeg wants to merge 5 commits into
pingdotgg:mainfrom
darkyeg:fix/bidi-text-direction
Closed

darkyeg wants to merge 5 commits into
pingdotgg:mainfrom
darkyeg:fix/bidi-text-direction

Conversation

@darkyeg

@darkyeg darkyeg commented Apr 17, 2026 •

Copy link
Copy Markdown

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
Presentation-only CSS and HTML attributes with no auth, data, or API changes; main risk is minor layout regressions in edge LTR cases.

Overview
Improves readability of mixed RTL/LTR content (e.g. Arabic, Hebrew with English) by letting the browser infer text direction per block instead of forcing LTR everywhere.

dir="auto" is added on chat markdown, the composer ContentEditable, plan sidebar copy (explanations, steps, titles), thread titles in the sidebar and header, pending user-input questions/options, plan banners/cards, and archived thread titles in settings.

index.css adds unicode-bidi: plaintext on chat markdown prose and on .user-message-text / .composer-editor-bidi for per-line direction in pre-wrap text; keeps pre / code / table LTR with unicode-bidi: isolate. List/blockquote/table styling switches to logical properties (padding-inline-start, border-inline-start, text-align: start).

A few controls use text-start instead of text-left so alignment follows layout direction in RTL.

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

Note

Add bidirectional text support for RTL languages across chat UI components

  • Adds dir="auto" to text-bearing elements across chat components (ChatMarkdown, ComposerPromptEditor, PlanSidebar, ChatHeader, sidebar thread titles, plan cards, and archived thread settings) so each element auto-detects RTL/LTR direction from its content.
  • Updates index.css with bidi-aware CSS: sets unicode-bidi: plaintext on text elements in .chat-markdown for per-paragraph direction detection, forces direction: ltr on code blocks and tables, and switches list/blockquote spacing to logical CSS properties (padding-inline-start, border-inline-start).
  • Changes a text-left class to text-start in PlanSidebar for logical alignment in bidi contexts.
📊 Macroscope summarized 3cc50de. 10 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented Apr 17, 2026 •

Copy link
Copy Markdown

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: 5100bd3b-100e-45c7-90e0-7b7010a36136

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
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 17, 2026
@macroscopeapp

macroscopeapp Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found.

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

@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

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 e2f066b3386a1dd1b0b8fd2d916eafa75f5634a4. Configure here.

Comment thread apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx Outdated
@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
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 17, 2026
darkyeg added 5 commits June 16, 2026 11:11
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.
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.
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.
…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.
@juliusmarminge
juliusmarminge force-pushed the fix/bidi-text-direction branch from d1fd51c to 3cc50de Compare June 16, 2026 18:18
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 16, 2026 18:18

Dismissing prior approval to re-evaluate 3cc50de

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 16, 2026
Comment thread apps/web/src/index.css

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium

.chat-markdown li.task-list-item {
list-style-type: none;
}
.chat-markdown li.task-list-item input[type="checkbox"] {
margin: 0 0.35em 0.15em -1.25rem;
vertical-align: middle;
}

The task list checkbox uses physical margin: 0 0.35em 0.15em -1.25rem, which pulls the checkbox left with negative margin. In RTL contexts (now enabled by unicode-bidi: plaintext on li elements), the checkbox misaligns because -1.25rem remains left-bound instead of following the inline-start direction. Use margin-inline-start: -1.25rem with separate inline-end and block margins so the negative margin adapts to text direction.

Suggested change
.chat-markdown li.task-list-item input[type="checkbox"] {
- margin: 0 0.35em 0.15em -1.25rem;
+ margin-block: 0 0.15em;
+ margin-inline: -1.25rem 0.35em;
vertical-align: middle;
}
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/index.css around lines 449-456:

The task list checkbox uses physical `margin: 0 0.35em 0.15em -1.25rem`, which pulls the checkbox left with negative margin. In RTL contexts (now enabled by `unicode-bidi: plaintext` on `li` elements), the checkbox misaligns because `-1.25rem` remains left-bound instead of following the inline-start direction. Use `margin-inline-start: -1.25rem` with separate inline-end and block margins so the negative margin adapts to text direction.

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as part of backlog cleanup: this PR is stale, currently conflicting with main, has no approval, and has not had active remediation for 30+ days. If the change is still relevant, please rebase onto current main and request reopening or submit a focused current diff. Thank you for the contribution.

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