Skip to content

Add RTL stylesheet and support for right-to-left languages that confgurable in config.json #30327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

rezaei92
Copy link

Hello, thank you for good support to Element Web.

This PR adds RTL support to Element Web by configuring text direction (ltr or rtl) via config.json. The direction field sets the dir attribute on the <html> element and loads an _rtl-style.pcss stylesheet that overrides LTR-specific properties for RTL languages. It uses the [dir="rtl"] selector for automation. Tested with Persian (Farsi), Arabic and Hebrew on Chrome and Firefox. Includes documentation updates.

Fixes requirements like as mentioned #28120, #22445, #21731, #14520, #5604, #2922, #1712, #26283, etc.

RTL display:

image image

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

@rezaei92 rezaei92 requested a review from a team as a code owner July 16, 2025 09:20
@rezaei92 rezaei92 requested review from dbkr and t3chguy July 16, 2025 09:20
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Mohammad Rezaei seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Jul 16, 2025
@t3chguy
Copy link
Member

t3chguy commented Jul 16, 2025

Why would it be set in config.json given user language is user selectable? What would happen if config.json said RTL but the user's language is English?

@rezaei92
Copy link
Author

Why would it be set in config.json given user language is user selectable? What would happen if config.json said RTL but the user's language is English?

Thank you for your feedback and for taking the time to review this PR!

The decision to include the direction setting in config.json was made to provide greater flexibility for customization, allowing administrators or users to explicitly control the text direction (LTR or RTL) independently of the selected language. This is particularly useful in cases where users prefer a specific direction for their UI, even if it deviates from the default direction of their chosen language. For example, some users might select an RTL language like Persian (Farsi), Arabic, or Hebrew but prefer an LTR layout due to personal habits, accessibility needs, or specific deployment requirements (e.g., in multilingual environments where LTR is standardized).

If config.json specifies RTL, but the user selects English, the UI applies RTL and loads _rtl-style.pcss. Without a direction setting, it defaults to LTR, ensuring English users are unaffected unless configured otherwise.

To improve, we could align direction with the user’s language by default (e.g., RTL for Arabic, LTR for English) or add a UI option to override the config. I’m open to refining this to better support LTR and RTL communities. Please share your feedback. If you could accept this PR for now, we can work together to improve it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants