EDIT: Firefox seems to be the only browser that supports this. I'm looking for a solution for Chrome.
I'm trying to have a svg header that repeats on multiple pages of a website, and I can achieve that with <use>
, but the problem is that a hyperlink in the svg (namely the logo) does not respond to click events.
Here is a simplified snippet that shows the problem. The left box with the inline hyperlink works fine, but when it is included via the <use>
tag, it doesn't respond to a click, as can be seen with the right box.
<svg width="300" height="100">
<svg id="link">
<a href="https://google.com">
<rect width="100" height="100" />
</a>
</svg>
<use x="200" xlink:href="#link"></use>
</svg>
It's also available here: https://jsfiddle.net/sh8276gu