Skip to content

feat(desktop): support RTL direction and alignment for non-LTR texts#35635

Closed
majidasgari wants to merge 1 commit into
anomalyco:devfrom
majidasgari:desktop-rtl-support
Closed

feat(desktop): support RTL direction and alignment for non-LTR texts#35635
majidasgari wants to merge 1 commit into
anomalyco:devfrom
majidasgari:desktop-rtl-support

Conversation

@majidasgari

Copy link
Copy Markdown

feat(desktop): support RTL direction and alignment for non-LTR text in markdown and editor

Implement dynamic Right-to-Left (RTL) text direction and right-alignment specifically for the desktop client when rendering or typing RTL scripts (Persian, Arabic, Hebrew, etc.).

Why:

  • In the desktop application, messages and query inputs containing RTL characters currently default to LTR alignment and direction, which highly degrades readability.

What:

  • Guarded all RTL logic behind a window.api check (exposed by the Electron preload script) to ensure it only applies within the desktop client wrapper.
  • Extended the Markdown renderer's decorate function in session-ui to dynamically apply direction: rtl and text-align: right on paragraphs (p), table cells (td, th), list items (li), and headings (h1-h6) containing RTL script characters.
  • Structured Q&A tool component rendering elements in message-part.tsx are also properly styled using conditional direction and alignment attributes.
  • Added a reactive isRtl memo inside the composer PromptInput component to automatically toggle the input's direction/alignment as soon as the user starts typing in an RTL language.

Impact:

  • Zero side-effects on the web application or browser builds, keeping the web client's behavior and performance untouched.

Issue for this PR

Closes #

Type of change

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

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

…n markdown and editor

Implement dynamic Right-to-Left (RTL) text direction and right-alignment specifically for the desktop client when rendering or typing RTL scripts (Persian, Arabic, Hebrew, etc.).

Why:
- In the desktop application, messages and query inputs containing RTL characters currently default to LTR alignment and direction, which highly degrades readability.

What:
- Guarded all RTL logic behind a `window.api` check (exposed by the Electron preload script) to ensure it only applies within the desktop client wrapper.
- Extended the Markdown renderer's `decorate` function in `session-ui` to dynamically apply `direction: rtl` and `text-align: right` on paragraphs (`p`), table cells (`td`, `th`), list items (`li`), and headings (`h1`-`h6`) containing RTL script characters.
- Structured Q&A tool component rendering elements in `message-part.tsx` are also properly styled using conditional direction and alignment attributes.
- Added a reactive `isRtl` memo inside the composer `PromptInput` component to automatically toggle the input's direction/alignment as soon as the user starts typing in an RTL language.

Impact:
- Zero side-effects on the web application or browser builds, keeping the web client's behavior and performance untouched.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No "Type of change" checkbox is checked. Please select at least one.
  • "How did you verify your code works?" section is empty. Please explain how you tested.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicates Found

PR #32247 - feat(ui): full RTL support for Arabic and RTL languages

PR #32727 - fix(app): auto-detect text direction (RTL) for messages and composer

These PRs likely address similar or overlapping functionality for RTL text support. You may want to review their implementation approach and status to determine if PR #35635 duplicates their work or provides complementary desktop-specific enhancements.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 7, 2026
@github-actions github-actions Bot closed this Jul 7, 2026
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