RESOLVED FIXED Bug 220241
Web Inspector: RTL content inside elements is reversed and unreadable
https://bugs.webkit.org/show_bug.cgi?id=220241
Summary Web Inspector: RTL content inside elements is reversed and unreadable
Ebrahim Byagowi
Reported 2021-01-04 07:13:29 PST
Created attachment 416940 [details] RTL text inside the element is reversed and is unreadable The fix in https://bugs.webkit.org/show_bug.cgi?id=207214 has caused Web Inspector to display RTL text completely reversed making RTL text content used inside elements completely unreadable. There is fortunately a solution to this that won't regress the fix there and to use "unicode-bidi: isolate" instead "unicode-bidi: isolate-override;" and I've applied the fix locally checking whether it won't regress the original issue and also fixes this disturbing issue. Test page used in the attachment to show the issue: data:text/html;charset=utf8,سیب "unicode-bidi: bidi-override" (and now the recently introduced isolate-override) is really something of past and was designed to make compatibility with text written before bidi and unicode era and is something should be and is avoided by modern web development.
Attachments
RTL text inside the element is reversed and is unreadable (64.59 KB, image/png)
2021-01-04 07:13 PST, Ebrahim Byagowi
no flags
Patch (1.31 KB, patch)
2021-01-04 07:51 PST, Ebrahim Byagowi
no flags
Screenshot (3.75 MB, image/png)
2021-01-12 13:02 PST, Myles C. Maxfield
no flags
Ebrahim Byagowi
Comment 1 2021-01-04 07:51:05 PST
Blaze Burg
Comment 2 2021-01-05 09:56:33 PST
(In reply to Ebrahim Byagowi from comment #0) > Created attachment 416940 [details] > RTL text inside the element is reversed and is unreadable > > The fix in https://bugs.webkit.org/show_bug.cgi?id=207214 has caused Web > Inspector to display RTL text completely reversed making RTL text content > used inside elements completely unreadable. There is fortunately a solution > to this that won't regress the fix there and to use "unicode-bidi: isolate" > instead "unicode-bidi: isolate-override;" and I've applied the fix locally > checking whether it won't regress the original issue and also fixes this > disturbing issue. > > Test page used in the attachment to show the issue: > > data:text/html;charset=utf8,سیب > > "unicode-bidi: bidi-override" (and now the recently introduced > isolate-override) is really something of past and was designed to make > compatibility with text written before bidi and unicode era and is something > should be and is avoided by modern web development. Thanks for investigating this. I noticed that Web Inspector is in LTR layout mode in your screenshots. That's fine, but could you please ensure that the behavior is also correct when in RTL layout mode?
Radar WebKit Bug Importer
Comment 3 2021-01-05 09:56:50 PST
Ebrahim Byagowi
Comment 4 2021-01-06 08:41:40 PST
> Thanks for investigating this. I noticed that Web Inspector is in LTR layout mode in your screenshots. That's fine, but could you please ensure that the behavior is also correct when in RTL layout mode? Thank you for reaching to this :) Does Web Inspector even have a RTL mode? This fix won't have anything to do with it AFAICT still how can I run Web Inspector in RTL mode? I am using the run-minibrowser for testings and changing system language didn't have any apparent effect to it.
Myles C. Maxfield
Comment 5 2021-01-12 13:02:02 PST
If you set your system language to Arabic and restart Safari, there should be a big change. See the screenshot I attached. You're right that RTL text looks broken when the inspector is in LTR mode. We just want to make sure that this patch doesn't regress behavior when the inspector is in RTL mode.
Myles C. Maxfield
Comment 6 2021-01-12 13:02:26 PST
Created attachment 417483 [details] Screenshot
Sam Sneddon [:gsnedders]
Comment 7 2021-01-13 08:08:39 PST
We previously fixed a similar issue in bug 170298 by adding bdo=auto to the DOM tree (which in the UA stylesheet adds unicode-bidi: isolate). Bug 207214, which introduced this regression, was outright wrong using isolate-override (it only makes sense in combination with an explicitly set direction, which we don't have for page content). In general, using the dir attribute (and potentially the bdo/bdi elements) is recommended given it's generally more obvious about what it does. There's probably a strong argument that if the page has <span dir=rtl>foo</span> then we want to end up with <span class="html-text-node" dir=rtl>foo</span> in the Inspector, rather than using auto there. That said, with the patch attached to this bug, we're in a better place than before bug 207214, so I'm a non-reviewer r+ on this.
Blaze Burg
Comment 8 2021-01-13 14:07:15 PST
Comment on attachment 416942 [details] Patch r=me, thanks for the help everyone.
EWS
Comment 9 2021-01-13 14:42:38 PST
Committed r271458: <https://trac.webkit.org/changeset/271458> All reviewed patches have been landed. Closing bug and clearing flags on attachment 416942 [details].
Note You need to log in before you can comment on or make changes to this bug.