Skip to content
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

@usernames should not determine bidi direction #870

Closed
NeatNit opened this issue Aug 6, 2024 · 4 comments · Fixed by #906
Closed

@usernames should not determine bidi direction #870

NeatNit opened this issue Aug 6, 2024 · 4 comments · Fixed by #906

Comments

@NeatNit
Copy link

NeatNit commented Aug 6, 2024

Describe the bug
For users in Hebrew, Arabic or Persian (I think) which are written right to left, the @mentions at the start of a reply cause the entire first paragraph to be rendered left to right. This causes it to be less readable.

If this were HTML, I'd suggest you wrap any mention in a bdi tag: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi (or use CSS which can also do that).

To Reproduce
Steps to reproduce the behavior:

  1. Reply to anything
  2. Include the default mention, and write in a RTL language. Finish with a punctuation mark. For example:
    @whoever שיהיה לך יום טוב.
  3. Post and look at the result

Expected behavior
The paragraph should be rendered in RTL, aligned right, and the punctuation mark should be on the left at the end of the text.

Screenshots or video
Screenshot_20240806_044530_Pachli

Links
https://fosstodon.org/@neatnit/112912082714265949

Versions
Pachli 2.7.0, Android 14, OneUI 6.1, Samsung Galaxy S22+.

Affirmation
I did not check for other issues, sorry. Feels like the kind of issue that would be resolved soon after it's brought up.

@nikclayton
Copy link
Contributor

Would you be able to do a quick mockup showing what that screenshot should look like if things are working correctly? That'll help me verify any changes are working correctly.

Note to self: https://developer.android.com/reference/android/text/BidiFormatter

@NeatNit
Copy link
Author

NeatNit commented Aug 7, 2024

No need for a mockup, the website does it fine:

Screenshot_20240807_084321_Fennec

@NeatNit
Copy link
Author

NeatNit commented Aug 7, 2024

Oh, I just noticed that the behavior is already (almost) correct in the main timeline (or my timeline with replies), but not when entering the post or its parent.

same comment in timeline showing correct behavior

@NeatNit
Copy link
Author

NeatNit commented Aug 7, 2024

Though, the @ symbol should appear to the left of a username in either case.

Effectively, it seems like it's doing this: @<bdi>username</bdi> {{rest of the message}}

When it should be doing this: <bdi>@username</bdi> {{rest of the message}}

And of course, this should apply to each username mention individually, even in the middle of a post.

nikclayton added a commit that referenced this issue Aug 28, 2024
Previous code didn't set the textDirection for the status content,
so the first para of RTL text might be rendered incorrectly.

In addition, mentions and tags weren't BIDI wrapped, so would appear
as "foo@" and "foo#" in RTL statuses, instead of "@foo" and "#foo".

Fix both of these issues.

Fixes #870
nikclayton added a commit that referenced this issue Aug 28, 2024
)

Previous code didn't set the textDirection for the status content, so
the first para of RTL text might be rendered incorrectly.

In addition, mentions and tags weren't BIDI wrapped, so would appear as
"foo@" and "foo#" in RTL statuses, instead of "@foo" and "#foo".

Fix both of these issues.

Fixes #870
@github-project-automation github-project-automation bot moved this from Todo to Done in Pachli roadmap Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants