-
Notifications
You must be signed in to change notification settings - Fork 53
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
Embedding of custom icons via 'use' element prevents working with complex SVG #727
Comments
It looks like the custom icon gets rendered using I have approximately zero experience with SVGs, but I wonder if we could inline the SVG probided by |
My thoughts exactly - maybe something like this? (Disclaimer: I have basically zero experience with Vue, this may be downright laughably wrong, my apologies if so.) <template>
<img
aria-hidden="true"
class="svg-icon"
src="`${themeOverrideURL}`"
width="100%" height="100%"
v-if="themeOverrideURL"
/>
<svg
aria-hidden="true"
class="svg-icon"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
v-else
>
<slot />
</svg>
</template> This approach would also allow using non-SVG icons and remove the requirement of ensuring the appropriate ID is set on the root element of SVGs. |
CC: @dobromir-hristov @mportiz08 any thoughts here? |
So there are a few things we can and cant do with SVGs:
If the path to the SVG is not in the same domain, there are CORS issues involved, so we are forced to use Going directly to @mportiz08 please pitch in, if you have any thoughts on this, or I made mistakes somewhere. I remember you worked on this feature mostly. |
Bummer. I wasn't aware of those existing bugs regarding We considered using the I don't have an alternate idea in mind at the moment, but it's probably worth considering if we should revisit how custom icons work if these limitations are as frustrating as you point out. |
I would be delighted to see the bugs in WebKit's handling of |
Description
When a custom icon for a given ID (such as
technology
) is set intheme-settings.json
, the icon is embedded in the rendered page via SVG's<use/>
element. This runs afoul of WebKit bugs which prevent non-trivial SVGs from rendering properly when embedded this way.Checklist
main
branch of this package.Expected Behavior
I expect using a custom icon to allow for the full range of SVG features.
Actual behavior
As the custom icon is embedded via
<use/>
instead of being referenced directly or embedded verbatim, various WebKit bugs (see below) prevent using even "basic" SVG features like<linearGradient>
or embedded<style>
.https://bugs.webkit.org/show_bug.cgi?id=258225
https://bugs.webkit.org/show_bug.cgi?id=65344
https://bugs.webkit.org/show_bug.cgi?id=104169
https://bugs.webkit.org/show_bug.cgi?id=179724
https://bugs.chromium.org/p/chromium/issues/detail?id=109212
Steps To Reproduce
(Note: Numerous variations, such as using
<defs>
,<g>
, etc. were tried; none worked.)Swift-DocC-Render Version Information
c142759
The text was updated successfully, but these errors were encountered: