Hyperlink in Graphviz node doesn't work

I forked the basic graphviz example and added a URL attribute to one of the nodes here: Graphviz / Brent Shields (he) / Observable. Clicking on the ‘b’ node in the graph crashes all of the cells in the document. I assume this is related to the sandboxing of the cells, but is there anyway to work around this?

The breakage is on an SVG link, minimal example:

svg`<svg viewBox="0 0 160 40" xmlns="http://www.w3.org/2000/svg">
  <a xlink:href="https://example.com"><text x="10" y="25">link</text></a>
</svg>`

Seems fixable. Platform already does some magic to make normal anchor links work from the iframe context, this seems like a gap in that workaround.

I would suggest reporting it in the Github issues page.

Clicking the link attempts to open it inside the iframe. To have links work properly add the attribute target="_top" to each:

dot`digraph { b [URL="https://google.com" target="_top"]; a -> b; }`
2 Likes

Thanks so much, that worked.

This seems to be a bug in Chrome where it doesn’t respect the page’s <base target="_top"> for links in SVG. This is not a problem in Safari.

1 Like