From 9cef7945c04620eb0b18a200aa0db803dba99c5a Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 25 Jun 2021 02:03:05 +0200 Subject: [PATCH] Fix RTL text in video titles on Firefox The behavior was as follow: on Right-To-Left text (e.g Arabic) that is wrapped (because it's too long to fit on one line), the second row and following rows may or may not be right aligned (as RTL text should be). Opening the devtools fixes that alignement, as consistently as closing the devtool breaks it. This problem seems to arrive only in the following configurations (link nested in a paragraph, both of which may or may not have the dir= attribute): * `

RTL_TEXT

` * `

RTL_TEXT

` * `

RTL_TEXT

` with the following CSS: ``` p { unicode-bidi: plaintext; text-align: start; } ``` Changing the HTML to the following configuration (a paragraph with the dir= attribute, nested in a link) seems to fix it: `

RTL_TEXT

` --- src/invidious/views/components/item.ecr | 49 +++++++++++-------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 6f027bee7..85ff53a1f 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -2,13 +2,13 @@
<% case item when %> <% when SearchChannel %> - + <% if !env.get("preferences").as(Preferences).thin_mode %>
"/>
<% end %> -

<%= item.author %>

+

<%= HTML.escape(item.author) %>

<%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %>

<% if !item.auto_generated %>

<%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %>

<% end %> @@ -27,15 +27,13 @@

<%= number_with_separator(item.video_count) %> videos

<% end %> -

<%= item.title %>

+

<%= HTML.escape(item.title) %>

+ + +

<%= HTML.escape(item.author) %>

-

- - <%= item.author %> - -

<% when MixVideo %> - + <% if !env.get("preferences").as(Preferences).thin_mode %>
@@ -44,13 +42,11 @@ <% end %>
<% end %> -

<%= HTML.escape(item.title) %>

+

<%= HTML.escape(item.title) %>

+
+ +

<%= HTML.escape(item.author) %>

-

- - <%= item.author %> - -

<% when PlaylistVideo %> <% if !env.get("preferences").as(Preferences).thin_mode %> @@ -76,13 +72,11 @@ <% end %> <% end %> -

<%= HTML.escape(item.title) %>

+

<%= HTML.escape(item.title) %>

+ + +

<%= HTML.escape(item.author) %>

-

- - <%= item.author %> - -

<% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp.try &.> Time.utc %> @@ -98,8 +92,8 @@
<% else %> - <% if !env.get("preferences").as(Preferences).thin_mode %> - + + <% if !env.get("preferences").as(Preferences).thin_mode %>
<% if env.get? "show_watched" %> @@ -134,12 +128,13 @@

<%= recode_length_seconds(item.length_seconds) %>

<% end %>
-
- <% end %> -

<%= HTML.escape(item.title) %>

+ <% end %> +

<%= HTML.escape(item.title) %>

+ +
- <%= item.author %> +

<%= HTML.escape(item.author) %>