NEW 220386
`direction: rtl` on the root cannot be unset from JS
https://bugs.webkit.org/show_bug.cgi?id=220386
Summary `direction: rtl` on the root cannot be unset from JS
Tim Guan-tin Chien [:timdream]
Reported 2021-01-06 15:01:56 PST
Created attachment 417131 [details] direction-rtl.png STR: 1. Load this URL: data:text/html,<body style="direction: rtl">text</body> 2. Open the inspector and uncheck the CSS rule, or use the JS console and run `document.body.style.direction = ""` Alternative STR: 1. Load this URL: data:text/html,<body style="direction: rtl">text<script>setTimeout(() => document.body.style.direction = "", 1000)</script></body> Expected: The direction should flip to ltr (default) Actual: The page stays at rtl.
Attachments
direction-rtl.png (801.87 KB, image/png)
2021-01-06 15:01 PST, Tim Guan-tin Chien [:timdream]
no flags
Radar WebKit Bug Importer
Comment 1 2021-01-06 15:02:51 PST
Tim Guan-tin Chien [:timdream]
Comment 2 2021-01-06 15:21:28 PST
STP Release 118 (Safari 14.1, WebKit 15611.1.9) macOS 10.15.7 (19H15)
Alexey Proskuryakov
Comment 3 2021-01-06 18:37:14 PST
Setting document.body.style.direction to "ltr" works; removeProperty("direction") also fails to update the direction.
Simon Fraser (smfr)
Comment 4 2021-01-09 11:54:12 PST
Seems to be an issue on the root (body or html) only.
Simon Fraser (smfr)
Comment 5 2021-01-09 12:09:10 PST
I think this is about this code in resolveForDocument(): if (bodyRenderer && !docElementRenderer->style().hasExplicitlySetDirection()) documentStyle.setDirection(bodyRenderer->style().direction()); else documentStyle.setDirection(docElementRenderer->style().direction()); which seems to put the old body style on the document.
Note You need to log in before you can comment on or make changes to this bug.