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

Be explicit about the firstStrong text direction on UGC #3328

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Be explicit about the firstStrong text direction on UGC #3328

merged 1 commit into from
Mar 2, 2023

Conversation

nikclayton
Copy link
Contributor

activity_account sets the root text direction to anyRtl.

This is OK for UI elements, but can be a problem for user generated content (UGC) that may contain bidirectional text.

Fix this by explicitly restoring the default behaviour, firstStrong, on views in activity_account that can show UGC.

Fixes #3294

`activity_account` sets the root text direction to `anyRtl`.

This is OK for UI elements, but can be a problem for user generated content
(UGC) that may contain bidirectional text.

Fix this by explicitly restoring the default behaviour, `firstStrong`, on
views in `activity_account` that can show UGC.

Fixes #3294
@nikclayton
Copy link
Contributor Author

nikclayton commented Feb 17, 2023

I think this is correct (my analysis is in the linked issue, with links to other PRs that have dealt with this), but someone more knowledgeable than me about bidi text handling should take a look.

If you want to compare before/after, my profile bio (@[email protected]) currently contains a mix of LTR and RTL text that did not render correctly before this PR, and now renders correctly with it.

@nikclayton nikclayton changed the title By explicit about the firstStrong text direction on UGC Be explicit about the firstStrong text direction on UGC Feb 17, 2023
@Lakoja
Copy link
Collaborator

Lakoja commented Feb 27, 2023

Also status are user-generated content.

So to be consistent with the Mastodon Web gui it should (at least) also be set for item_conversation.xml#status_content and item_status.xml#status_content.

(Note: In the Web gui it doesn't work for the username. The display of that seems to be a bit random: different in text field than actual display.)

Generally I wonder if it is possible to set an application-wide default for textDirection. (I'd expect a consistent behavior for everything, I guess.)

@Lakoja
Copy link
Collaborator

Lakoja commented Feb 27, 2023

Maybe it would also be sensible to remove the (3) text directions "any rtl" for a few activities.

@nikclayton
Copy link
Contributor Author

@Lakoja I don't think that's necessary, per #3294 (comment). To summarise:

  1. The Android default is firstStrong. This is why item_conversation and item_status work correctly before this PR.
  2. This was overridden for some wrapper views in activity_account.xml in Improve RTL support #964 (the discussion in the PR has screenshots showing why anyRTL makes sense in a few places)
  3. This PR restores the default for some children of the wrapper views that were unintentionally affected by the change in (2)

@nikclayton
Copy link
Contributor Author

I checked this against the profile of https://mastodon.social/@[email protected] who runs https://notarabic.com.

Without this PR the "pronouns" section of his account profile does not display correctly, appearing as "هو/he/him/".

This is (a) different from the web UI (which shows "he/him/هو") and (b) is also different from what you get if you copy that text out of Tusky and paste it in to an app which does handle this correctly. Tusky is showing the Arabic text in the wrong place (on the left) and has the spare "/" on the right.

So I'm now confident that this is the correct fix.

@connyduck connyduck merged commit 7261fa0 into tuskyapp:develop Mar 2, 2023
@nikclayton nikclayton deleted the 3294-bidi-text-error branch March 2, 2023 18:16
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.

Profile text displayed right to left but correct on web
3 participants