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

Invalid HTML when using multiple icons #896

Closed
w3rafu opened this issue Jul 26, 2022 · 4 comments
Closed

Invalid HTML when using multiple icons #896

w3rafu opened this issue Jul 26, 2022 · 4 comments

Comments

@w3rafu
Copy link

w3rafu commented Jul 26, 2022

Hello, Rob.

After running w3 validator, I found multiple errors caused by icons path duplicating ID's.

They all render the same ID.

e.g.
<path id="path-0" ... >
<path id="path-0" ... >
<path id="path-0" ... >

Any workaround for this?

Thanks!

@inbetweencode
Copy link

I am actually on this issue because I think to have extra information.

The first icon on the page is normal: having a single .
Subsequent SVG's have respectively 3, 5 and 6 's.
I have no explaination for this behaviour.

@josdejong
Copy link
Contributor

These id's are generated here:

{#if self.paths}
{#each self.paths as path, i}
<Path id="{i}" data="{path}"/>
{/each}

Which creates a Path component with (mostly) id="path-0"

<path id="path-{id}" {...data} />

I guess the solution would be to remove the id attribute from paths (they can never be unique this way when you use the same icon twice).

@josdejong
Copy link
Contributor

I created a PR with a possible fix: #930

@RobBrazier
Copy link
Owner

apologies for the delay, I've merged Jos's PR now and the fix should be available in 3.0.1

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

4 participants