the-new-css-reset icon indicating copy to clipboard operation
the-new-css-reset copied to clipboard

svg use elements are not show in firefox

Open nidi3 opened this issue 1 year ago • 3 comments

https://jsfiddle.net/7hsnzrpa/1/

In Chrome, the circle is visible, in Firefox not. (MacOS)

nidi3 avatar May 14 '24 15:05 nidi3

Tested the jsfiddle sample on Windows and Android: Works fine in Chrome and Edge. Produced the same issue with Firefox.

Removing the reference to css-reset fixes the issue. I dug around but can't find the cause.

graymatter00 avatar May 15 '24 05:05 graymatter00

I was able to figure out a bit, but not a solution. I determined that the issue is that the cx and cy attributes are getting overwritten, similar to how image dimensions would get overwritten if the img tag was not excluded. I believe that this is occurring because the circle is being rendered in shadow dom and the ’svg *’ selector is not being recognized there.

If you put circle in the exclusion list, eveyrhing works, but listing all the possible svg elements in there would make it very long and not a great solution IMO. However, I have found no other way to target this wierd shaddow dom rendering.

On May 15, 2024, at 12:23 AM, Tony Gray @.***> wrote:

Tested the jsfiddle sample on Windows and Android: Works fine in Chrome and Edge. Produced the same issue with Firefox.

Removing the reference to css-reset fixes the issue. I dug around but can't find the cause.

— Reply to this email directly, view it on GitHub https://github.com/elad2412/the-new-css-reset/issues/88#issuecomment-2111609585, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6IUNUKHFBAFMLH45ZVRRU3ZCLWL7AVCNFSM6AAAAABHWOZFXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJRGYYDSNJYGU. You are receiving this because you are subscribed to this thread.

UniquePixels avatar May 15 '24 12:05 UniquePixels

Not a solution, but a workaround using symbol instead of defs...

<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/reset.css" />
<svg hidden>
  <symbol id="my-symbol">
    <circle cx="10" cy="10" r="5" />
  </symbol>
</svg>

<svg>
  <use href="#my-symbol" />
</svg>

This seems to work fine in Firefox on Windows.

graymatter00 avatar May 15 '24 13:05 graymatter00