Skip to content
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

--style-props on SVG components don’t work when passed as slot content #7950

Open
sophiamersmann opened this issue Oct 15, 2022 · 1 comment

Comments

@sophiamersmann
Copy link

Describe the bug

When a SVG component is passed as slot content, then --style-props wraps the markup in a <div />, not a <g />, which breaks the SVG.

For example, say I have a <Circle /> component that renders a <circle />, then this works:

<svg width=50 height=50>
	<Circle --fill="orange" />
</svg>

But when I have a <Svg /> component with a slot, and pass <Circle /> as slot content:

<Svg>
	<Circle --fill="orange" />
</Svg>

then <circle /> is wrapped in a <div />, not a <g />, which breaks the SVG.

Reproduction

REPL: https://svelte.dev/repl/936c0e4352e249f69747c6635d8b58c0?version=3.51.0

Logs

No response

System Info

See REPL

Severity

annoyance

@msf-caesar
Copy link

In order for it to work you must follow the hierarchy, first its <svg> then its <circle>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants