SVG click events not firing/bubbling when using <use> element

点点圈 提交于 2019-11-30 04:19:24

Use pointer-events: none; on the svg. It worked for me.

The element is never the target of mouse events; however, mouse events may target its descendant elements if those descendants have pointer-events set to some other value. In these circumstances, mouse events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases.

https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

I had the same problem. The fix I use is to just put a transparent div over the svg. But that is not ideal of course.

anirban saha

I had the same problem and I used display: block or display: inline-block on the link and it worked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!