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

Generated SVG has static IDs which cause issues when there are two SVGs #3267

Closed
ittayd opened this issue Jul 28, 2022 · 6 comments · Fixed by #4825
Closed

Generated SVG has static IDs which cause issues when there are two SVGs #3267

ittayd opened this issue Jul 28, 2022 · 6 comments · Fixed by #4825
Assignees
Labels

Comments

@ittayd
Copy link

ittayd commented Jul 28, 2022

Describe the bug
In the attached (zipped) html, there are two SVGs generated by mermaid. Loaded in a browser they will render with arrowheads. However, if the first SVG style has 'display:none' then not only does it disappear (as expected), but also the arrow heads in the second SVG. The reason is that they are referenced as #arrowhead and so the browser finds them in the first SVG, which is not displayed, hence they are not displayed.

svgs.zip

Expected behavior
Create unique IDs. E.g. use the id passed to render as prefix.
(Note: there is another generic solution which is to wrap each SVG in an iframe via srcdoc. However, then styling in the outer doc can't be applied to the svg elements which for my context of static HTML files is not good)

Screenshots
When both are visible:
image

When first one is not displayed:
image

@ittayd ittayd added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jul 28, 2022
@dwhelan
Copy link

dwhelan commented Sep 17, 2022

I am working on #1871 and the root cause was non-unique ids for the SVG markers. And the fix for it was exactly what you suggested.

@williamthome
Copy link

@dwhelan Maybe it's also related to this? livebook-dev/livebook#1440

@dwhelan
Copy link

dwhelan commented Sep 30, 2022

Yes @williamthome, I believe this is root cause of what you saw with livebook-dev/livebook#1440. I do not have an ETA on getting that merged but will respond here when it is done. Is it urgent for you?

@williamthome
Copy link

Ah, sure. It's ok for me. I have no urgency.

@bjarkih
Copy link

bjarkih commented Oct 7, 2022

This is pretty urgent for me - would love to see your fix get merged in as soon as feasible @dwhelan 🙏🏻

@sidharthv96
Copy link
Member

Fixed in #4825

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