-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Change RTL detection to rely on unicode-bidi paragraph by paragraph #14573
Conversation
@@ -821,6 +822,7 @@ | |||
a { | |||
color: $secondary-text-color; | |||
text-decoration: none; | |||
unicode-bidi: isolate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this shouldn't be applied for all links but links such as mentions and hashtags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But all links are ascii (https://...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. Mastodon allows links with arbitrary text from other software.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would wager that the majority of links would be ascii URLs and we'll have consistently better results by not making them affect the directionality of the whole post.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to bring a live instance with these changes so I test multiple possible scenarios?
f13b30f
to
1d7de94
Compare
1d7de94
to
5d50133
Compare
It might not be well-supported in Safari: https://caniuse.com/#feat=mdn-css_properties_unicode-bidi_plaintext |
Okay, so I see two options here. Maybe we can get away with this not working in Safari, who knows how many Safari users we have that would be affected by this (directionality of the posts would be affected by interface language, so if you use the UI in a right-to-left language, you'd see posts right-to-left as well). Or maybe we keep the flawed detection code and the |
It could be ok, but I'm not sure…
If I understand the specs correctly, the That being said, the spec says “Authors should not use unicode-bidi in HTML documents.” An alternative could be to not set the direction on toots, and wrap them and each of their |
5d50133
to
598a2c6
Compare
I have heard that I'm in favour of relying on browser support here. |
Using 'dir=auto' will handle everything but excluding mentions in the beginning of the paragraph. |
My motivation here is that #15218 seems to indicate some kind of recursion error in the |
Great. Counting seconds to see this change on instances. Thank you |
I have noticed a little issue when the language is set to Persian (and for sure other RTL ones) which is making little issue with links starting with LTR characters. This can be solved by adding Test this toot: https://mas.to/web/statuses/105419096662730287 and it seems we need this as well to make sure mentions would render properly: .h-card {
unicode-bidi: plaintext;
} and this is the result in both RTL and LTR direction: sum up:These are the fix: .reply-indicator__content p, .status__content p {
direction: initial;
}
.reply-indicator__content a, .status__content a {
unicode-bidi: initial;
}
.h-card {
unicode-bidi: plaintext;
} |
Ref: https://discourse.joinmastodon.org/t/improve-bidi-support-a-better-support-for-rtl/2876