Bug 254549 - REGRESSION(259807@main): CSS variables are not applied to the SVG use element's shadow tree
Summary: REGRESSION(259807@main): CSS variables are not applied to the SVG use element...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Antti Koivisto
URL:
Keywords: BrowserCompat, InRadar
: 255282 255985 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-03-27 15:07 PDT by Mauri
Modified: 2023-05-24 14:42 PDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mauri 2023-03-27 15:07:35 PDT
We're using CSS variables to style things inside an SVG. We're dynamically importing SVGs using the `<use>` element. This element creates a Shadow DOM. We're not able to see variables inside that Shadow DOM.

Steps to Reproduce: 
    
    1) Use iOS Safari 16.4 (it works fine on 16.3)      

    2) Go to this page https://ios-safari-bug-yt1o.glide.page
    
    3) You'll see two buttons, Add and Delete, with their icons.


Actual Results:

    Icons are black colored.

Expected Results:

    Icons should match the text color.
 
Build Date & Hardware:
     
    Build 2023-03-27 on iOS 16.4 running on iPhone 13 Pro.

Additional Builds and Platforms:

    Works fine on iOS 16.3, Mac OS Safari Version 16.3 (18614.4.6.1.6), Chrome, and Firefox.
Comment 1 Ahmad Saleem 2023-03-27 16:36:54 PDT
I am able to reproduce this with Safari Technology Preview 166 as well.

Chrome Canary 114 and Firefox Nightly 113 works fine.

Since it worked fine in 16.3 but not in 16.4, should we rename title to add [Regression - 16.4]?
Comment 2 Ahmad Saleem 2023-03-27 16:56:37 PDT
NOTE - WebKit ToT (262178@main) also has same behavior as Safari 16.4. So this is not fixed yet on trunk as well.
Comment 3 Radar WebKit Bug Importer 2023-03-27 18:56:38 PDT
<rdar://problem/107295588>
Comment 4 Mauri 2023-03-28 05:48:58 PDT
(In reply to Ahmad Saleem from comment #1)
> I am able to reproduce this with Safari Technology Preview 166 as well.
> 
> Chrome Canary 114 and Firefox Nightly 113 works fine.
> 
> Since it worked fine in 16.3 but not in 16.4, should we rename title to add
> [Regression - 16.4]?

Thanks for looking at it. It's the first time I report something here, I'm happy to update the title if that's something I should do.

How do you handle these cases?
Comment 5 Said Abou-Hallawa 2023-03-28 13:30:12 PDT
This seems to be a recent regression. I could narrow it down to one of these changes https://commits.webkit.org/compare/259818@main...259759@main
Comment 6 Mauri 2023-03-28 15:15:05 PDT
(In reply to Mauri from comment #0)
> We're using CSS variables to style things inside an SVG. We're dynamically
> importing SVGs using the `<use>` element. This element creates a Shadow DOM.
> We're not able to see variables inside that Shadow DOM.
> 
> Steps to Reproduce: 
>     
>     1) Use iOS Safari 16.4 (it works fine on 16.3)      
> 
>     2) Go to this page https://ios-safari-bug-yt1o.glide.page
>     
>     3) You'll see two buttons, Add and Delete, with their icons.
> 
> 
> Actual Results:
> 
>     Icons are black colored.
> 
> Expected Results:
> 
>     Icons should match the text color.
>  
> Build Date & Hardware:
>      
>     Build 2023-03-27 on iOS 16.4 running on iPhone 13 Pro.
> 
> Additional Builds and Platforms:
> 
>     Works fine on iOS 16.3, Mac OS Safari Version 16.3 (18614.4.6.1.6),
> Chrome, and Firefox.

Updating steps to reproduce it:

Go to: https://ios-svg-bug.vercel.app/

You should see a red magnifying glass, instead, you're seeing a black one.

We manage to temporarily work around this on Safari 16.4, so the original URL for reproducing this won't work anymore. Please use https://ios-svg-bug.vercel.app/ instead
Comment 7 Antti Koivisto 2023-04-06 17:43:17 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12488
Comment 8 EWS 2023-04-06 21:25:29 PDT
Committed 262698@main (abf098f7f5b0): <https://commits.webkit.org/262698@main>

Reviewed commits have been landed. Closing PR #12488 and removing active labels.
Comment 9 Antti Koivisto 2023-04-07 05:34:58 PDT
The bug was specifically that custom properties were not inherited to the root element of an external SVG resource when it was used as a <use> target.
Comment 10 Mauri 2023-04-10 07:47:55 PDT
wow! Thank you so much for fixing this! 

When do we expect this to be released? Is there any doc that talks about your release cycle?
Comment 11 Said Abou-Hallawa 2023-04-11 16:16:27 PDT
*** Bug 255282 has been marked as a duplicate of this bug. ***
Comment 12 Jen Simmons 2023-04-21 13:57:05 PDT
> Is there any doc that talks about your release cycle?

No. 

> When do we expect this to be released?

I'd recommend testing in a future Safari 16.5 beta or later.
Comment 13 Said Abou-Hallawa 2023-05-24 14:42:35 PDT
*** Bug 255985 has been marked as a duplicate of this bug. ***