Skip to content

Commit f024f68

Browse files
authored
Merge pull request #5256 from dbluhm/fix/shadow-dom-targeting
Correct wrong element targeting on hover in shadow DOM
2 parents 45f4513 + 9ee5002 commit f024f68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/fx/hover.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,13 @@ function _hover(gd, evt, subplot, noHoverEvent) {
335335
return;
336336
}
337337

338-
var dbb = evt.target.getBoundingClientRect();
338+
// Discover event target, traversing open shadow roots.
339+
var target = evt.composedPath && evt.composedPath()[0];
340+
if(!target) {
341+
// Fallback for browsers not supporting composedPath
342+
target = evt.target;
343+
}
344+
var dbb = target.getBoundingClientRect();
339345

340346
xpx = evt.clientX - dbb.left;
341347
ypx = evt.clientY - dbb.top;

0 commit comments

Comments
 (0)