Pretty straightforward. I have an SVG embedded in my document through <object>
and I'm applying pointer-events:none
in the style at the root <svg>
. It works in Firefox but not in Chrome (I'm not interested in any other browsers at the moment)
MWE
Have an HTML file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Why you no fix, Chrome?</title>
</head>
<body>
<a id="click"><object data="svg.svg" type="image/svg+xml"></object></a>
<script>document.getElementById('click').addEventListener('click',e => console.log(e));</script>
</body>
</html>
Have an SVG file
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100" style="pointer-events:none">
<path fill="#4a90d6" fill-opacity="1" stroke="#222222" stroke-width="2" d="M 0 0 L 100 0 L 50 100 z" />
</svg>
If there is no way to allow the event to bubble up to the anchor (ie: stop svg from capturing), then a way to pass an event through the event horizon would also be nice
EDIT
I forgot to add that the <object>
element has to remain clickable. And I emphasize that the MWE works in Firefox but not in Chrome