Bug 255568 - :dir pseudo class doesn't invalidate after removing dir content attribute from document element
Summary: :dir pseudo class doesn't invalidate after removing dir content attribute fro...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-17 17:56 PDT by sorvell
Modified: 2023-04-25 02:27 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sorvell 2023-04-17 17:56:22 PDT
When direction is dynamically changed by setting the `dir` attribute to `rtl`, styles matching `:dir(rtl)` are applied as expected; however, if the `dir` attribute is removed, styles matching `:dir(rtl)` unexpectedly still apply.

See this reproduction: https://lit.dev/playground/#gist=b7c7e390a923d0a54b5c3211bd69a668

Expected: 
1. check the `rtl` checkbox to set document to rtl mode
2. styles matching `:dir(rtl)` apply
3. uncheck the `rtl` checkbox to set document back to default (ltr) direction
4. styles matching `:dir(rtl)` do *not* apply

Actual: 
1. check the `rtl` checkbox to set document to rtl mode
2. styles matching `:dir(rtl)` apply
3. uncheck the `rtl` checkbox to set document back to default (ltr) direction
4. styles matching `:dir(rtl)` *unexpectedly do* apply
Comment 1 Radar WebKit Bug Importer 2023-04-24 17:57:19 PDT
<rdar://problem/108480507>
Comment 2 Ryosuke Niwa 2023-04-24 22:18:45 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13134
Comment 3 EWS 2023-04-25 02:27:25 PDT
Committed 263357@main (a3084fe071c6): <https://commits.webkit.org/263357@main>

Reviewed commits have been landed. Closing PR #13134 and removing active labels.