Skip to content

Commit

Permalink
Merge pull request #5256 from dbluhm/fix/shadow-dom-targeting
Browse files Browse the repository at this point in the history
Correct wrong element targeting on hover in shadow DOM
  • Loading branch information
archmoj authored Jan 5, 2021
2 parents 45f4513 + 9ee5002 commit f024f68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,13 @@ function _hover(gd, evt, subplot, noHoverEvent) {
return;
}

var dbb = evt.target.getBoundingClientRect();
// Discover event target, traversing open shadow roots.
var target = evt.composedPath && evt.composedPath()[0];
if(!target) {
// Fallback for browsers not supporting composedPath
target = evt.target;
}
var dbb = target.getBoundingClientRect();

xpx = evt.clientX - dbb.left;
ypx = evt.clientY - dbb.top;
Expand Down

0 comments on commit f024f68

Please sign in to comment.