RocketChat / RocketChat/Rocket.Chat
RTL texts in RC message link previews are not shown right
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
In order to share a message from a chat to another one we should "Get Link" to that message and then paste it in the destination room which would show a preview of the message that the link refers to. It works but when the referred-to message is written in a Right-to-Left (RTL) language and also contains words from LTR-languages in the middle, the sentence structure breaks and is displayed in in a LTR format. I think the link preview shows texts in LTR format by default.
Steps to reproduce:
- Write a message in a RTL language and add some Latin words in the middle; for example:
(Translates to "this is an example of a message sample" in Persian)
- From the message menu click on Get Link.
- Paste the Link in another room/channel/chat.
Expected behavior:
The message should be shown like this:
این یک نمونه مثال از یک message است.Actual behavior:
It's shown in LTR format:
این یک نمونه مثال از یک message است.Server Setup Information:
- CentOS 7.9.2009
- Docker version 20.10.2
- Version of Rocket.Chat Server 3.10.4
Client Setup Information
The only ones I had access to are these:
- Chrome web browser on Windows 10
- Rocket.Chat Windows client version 3.1.1
The Android app Does Not have this issue and works as expected.
I don't have access to Mac/iOS/Linux/... clients to test.
Additional context
Maybe using <div dir="auto"> in the codes could help? I guess it decides based on the beginning character of the paragraph to whether show it in LTR or RTL.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the web client by sharing a message containing RTL text with embedded Latin words and pasting its Get Link URL into another room. Trace the message link preview rendering path and compare it with the Android behavior. Done means the preview preserves RTL direction and alignment while keeping embedded LTR words readable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100