diff --git a/draftlogs/6996_fix.md b/draftlogs/6996_fix.md new file mode 100644 index 00000000000..df2298d7d12 --- /dev/null +++ b/draftlogs/6996_fix.md @@ -0,0 +1,2 @@ +- Fix `getFullTransformMatrix` in shadow DOM [[#6996](https://github.com/plotly/plotly.js/pull/6996)], + with thanks to @OpportunityLiu for the contribution! diff --git a/src/lib/dom.js b/src/lib/dom.js index 08c8ee6b20b..6ed44293ea9 100644 --- a/src/lib/dom.js +++ b/src/lib/dom.js @@ -134,6 +134,9 @@ function getElementAndAncestors(element) { while(isTransformableElement(element)) { allElements.push(element); element = element.parentNode; + if(typeof ShadowRoot === 'function' && element instanceof ShadowRoot) { + element = element.host; + } } return allElements; }