Bug 285370

Summary: CSS custom property with revert-layer treats var() reference as string
Product: WebKit Reporter: Shaw Jia <xiaozj>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, koivisto, obrufau, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 18   
Hardware: iPhone / iPad   
OS: iOS 18   
See Also: https://bugs.webkit.org/show_bug.cgi?id=283942

Shaw Jia
Reported 2025-01-03 16:15:14 PST
I understand that currently, only registered, inheriting custom property can use revert-layer keyword: https://wpt.fyi/results/css/css-variables/variable-css-wide-keywords.html?label=master&label=experimental&aligned That being said, I found that when I do try to use it for a registered, inheriting custom property, it will treat any value that is a var() reference as plain string. For the following CSS, we expect the body text color to be red, but Safari renders it as black because revert-layer causes it to treat “ --color: var(--var);” as a plain string assignment rather a variable reference. body { @layer { --var:red; --color: var(--var); } @layer { --color:revert-layer; } color:var(--color); } @property --color { syntax:"*"; inherits:true; } Codepen example: https://codepen.io/Miragecraft/pen/gbYXGGW
Attachments
Radar WebKit Bug Importer
Comment 1 2025-01-10 16:16:14 PST
Ahmad Saleem
Comment 2 2025-07-02 09:26:36 PDT
It works fine now on 296910@main.
Note You need to log in before you can comment on or make changes to this bug.