-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svg icons don't work under shadow dom #9190
Comments
There has been no recent activity and this issue has been marked inactive. |
Re-bumping this. Here is another repro stackblitz: Tagging @zdrawku |
I found this userland workaround: It consists in:
I'm sure that @rkaraivanov can do a better job setting up the injection providers than me. This is a very basic example, for a more complex app overwriting the DOCUMENT can introduce other side effects, in that case what we can do is manually create the IgxIconService passing the proxied DOCUMENT only to it, something like: I guess a solution can be for the IgxIconService to accept an optional ElementRef and check if it contains a shadowRoot, that would make the whole thing a lot easier to set up. |
@pmoleri Yeah, you can totally override what's behind the The way the service is currently provided in root means it can't get element ref on it's own, so going for that will force the API methods to take one which seems a bit clunky. This could be the approach for some components though, but for the service I believe we have a different direction in mind - not to use the DOM to cache the SVGs at all. |
Nice. The extended class approach is nicer because I don't have to manually declare the provider
Yes, it seems the only sane route for SVG in shadow DOM, otherwise you'll get a cache copy in each shadow DOM and you can have many. It could be made optional, like if shadowDomSupport: true -> cache: off. |
Description
Describe the issue.
Steps to reproduce
https://stackblitz.com/edit/yu-gi-oh?file=src/app/combo-main/combo-main.component.ts
The above sample encapsulates the outlet of the combo in a shadow dom. At this point the svg icon "case-sensitive" doesn't appear.
The icon is in the dom but the svg is not visible.
Expected result
Svg icons should work under shadom dom encapsulation.
The text was updated successfully, but these errors were encountered: