Skip to content

feat(ui): add dir="auto" for bidirectional text support#25455

Open
Amr-9 wants to merge 1 commit intoanomalyco:devfrom
Amr-9:dev
Open

feat(ui): add dir="auto" for bidirectional text support#25455
Amr-9 wants to merge 1 commit intoanomalyco:devfrom
Amr-9:dev

Conversation

@Amr-9
Copy link
Copy Markdown

@Amr-9 Amr-9 commented May 2, 2026

Add dir="auto" to key text-rendering elements to enable automatic text-direction detection for multilingual and bidirectional content.

Issue for this PR

N/A

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

User messages typed in RTL languages (e.g. Arabic, Persian) were displaying left-aligned instead of right-to-left. This happened because the key text containers lacked a dir attribute, so the browser defaulted to LTR.

Adding dir="auto" fixes this by letting the browser detect text direction automatically based on the first strong character in each element — no extra configuration needed.

Files changed:

  • packages/app/src/components/prompt-input.tsx — the contenteditable input field
  • packages/ui/src/components/markdown.tsx — the Markdown root container (AI responses)
  • packages/ui/src/components/message-part.tsx — the user message text slot

How did you verify your code works?

Typed Arabic text in the prompt input and verified it renders right-to-left. Confirmed English text continues to render left-to-right in the same elements.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add dir="auto" to key text-rendering elements to enable automatic text-direction detection for multilingual and bidirectional content. Applied to the prompt input (contenteditable), the Markdown root container, and the user message text slot to improve handling of RTL/LTR text and user-entered content.
@Amr-9 Amr-9 requested a review from adamdotdevin as a code owner May 2, 2026 18:45
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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