| Summary: | `direction: rtl` on the root cannot be unset from JS | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Tim Guan-tin Chien [:timdream] <timdream> | ||||
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | ahmad.saleem792, bfulgham, koivisto, rniwa, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari Technology Preview | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Attachments: |
|
||||||
STP Release 118 (Safari 14.1, WebKit 15611.1.9) macOS 10.15.7 (19H15) Setting document.body.style.direction to "ltr" works; removeProperty("direction") also fails to update the direction.
Seems to be an issue on the root (body or html) only. 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.
|
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.