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

SVG ID conflict #10946

Closed
6 of 7 tasks
HotariTobu opened this issue Feb 23, 2025 · 0 comments
Closed
6 of 7 tasks

SVG ID conflict #10946

HotariTobu opened this issue Feb 23, 2025 · 0 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: duplicate This issue or pull request already exists in another issue or pull request

Comments

@HotariTobu
Copy link

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Referenced SVG elements conflict when rendering multiple SVG images as React components.

This is because minifying SVG images can result in duplicate element IDs.

SVG elements in the second or later SVG images are hidden by the first.

Image

Reproducible demo

https://stackblitz.com/edit/github-cf8uy1ck?file=src%2Fpages%2Findex.md

Steps to reproduce

  1. create 2 SVG images that include an element with ID and an element referring
  2. import the SVG images as React components
  3. render the React components on the same page

Expected behavior

All SVG elements have unique IDs and SVG images are displayed as same as when alone.

Actual behavior

Some elements are hidden or have a different style when SVG element IDs conflict.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@HotariTobu HotariTobu added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Feb 23, 2025
@Josh-Cena Josh-Cena added closed: duplicate This issue or pull request already exists in another issue or pull request and removed status: needs triage This issue has not been triaged by maintainers labels Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: duplicate This issue or pull request already exists in another issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants