RESOLVED FIXED 185940
CSS variables don't work as expected with borders and box shadow.
https://bugs.webkit.org/show_bug.cgi?id=185940
Summary CSS variables don't work as expected with borders and box shadow.
netanel.basal
Reported 2018-05-24 01:43:56 PDT
The following CSS doesn't work in Safari. :root { --primary-100: 38, 38, 38; } border: 1px solid rgba(var(--primary-100), 1); box-shadow: 10px 10px 8px 10px rgba(var(--primary-100), 1); Whereas in any other browser it's working as expected. It's worth mention that the following works in Safari: border-color: rgba(var(--primary-100), 1); border: rgba(var(--primary-100), 1) 1px solid;
Attachments
Radar WebKit Bug Importer
Comment 1 2018-05-26 19:13:09 PDT
shrpne
Comment 2 2018-06-08 02:26:50 PDT
https://jsfiddle.net/4sLxy763/1/ test case of this bug with box-shadow
Asad
Comment 3 2018-09-13 21:18:51 PDT
(In reply to shrpne from comment #2) > https://jsfiddle.net/4sLxy763/1/ > test case of this bug with box-shadow Workaround: Create a redundant variable first. --redundant: rgba(255,0,0, var(--shadow-opacity)); box-shadow: 0 0 10px var(--redundant);
sukide
Comment 4 2019-03-06 07:46:47 PST
Any updates on this? All the other browser engines fully support this, except WebKit. With more and more frameworks moving to CSS vars, shouldn't this feature be fully supported? Here's another test case: https://codepen.io/anon/pen/QodMZe
Casey Jacobson
Comment 5 2019-03-23 10:18:52 PDT
For anybody else who has run into this bug, I created a PostCSS plugin to add a workaround: https://www.npmjs.com/package/postcss-redundant-color-vars
Kyle Bavender
Comment 6 2019-12-06 07:16:20 PST
Reviewing this in Safari 13.0.3, I am unable to reproduce the error using either netanel.basal@datorama.com’s example CSS or shrpne’s JS Fiddle. Perhaps this has been fixed?
shrpne
Comment 7 2019-12-06 07:25:42 PST
Well, looks like it's fixed. Can't reproduce on Safari 13.0.3 too
Simon Fraser (smfr)
Comment 8 2019-12-06 10:27:49 PST
Agreed.
Note You need to log in before you can comment on or make changes to this bug.