Skip to content

Commit 1dfc11b

Browse files
committed
fix: correct wrong element targeting on hover
When using plotly inside of a shadow DOM, the calculations used to determine if the pointer has moved off of the graph would use the wrong element to determine the bounding box.
1 parent e62219a commit 1dfc11b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/fx/hover.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ function _hover(gd, evt, subplot, noHoverEvent) {
333333
return;
334334
}
335335

336-
var dbb = evt.target.getBoundingClientRect();
336+
var target = evt.composedPath && evt.composedPath()[0];
337+
if (!target) {
338+
return;
339+
}
340+
var dbb = target.getBoundingClientRect();
337341

338342
xpx = evt.clientX - dbb.left;
339343
ypx = evt.clientY - dbb.top;

0 commit comments

Comments
 (0)