From 38aa7609c11e4b2bb80a0fc9b72255c962fa97ff Mon Sep 17 00:00:00 2001 From: willrpike Date: Tue, 16 Feb 2021 11:17:03 -0800 Subject: [PATCH] Updates handleRequestInsertClipping to allow for shadowdom When we get the active element, if that element is within shadowdom, we must get the active element within the shadow dom. This fix checks to see if the shadowRoot exists as a property of the element and then updates activeElt to the activeElement in the shadow root. Tested in firefox using both shadow dom and non shadow dom. --- wx-src/content.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wx-src/content.js b/wx-src/content.js index e03c2db1..f53f6791 100644 --- a/wx-src/content.js +++ b/wx-src/content.js @@ -106,6 +106,11 @@ function handleRequestInsertClipping(aRequest) let htmlPaste = aRequest.htmlPaste; let autoLineBrk = aRequest.autoLineBreak; let activeElt = window.document.activeElement; + + // If element uses shadowDom, then we will pull the active element from shadowDom + if (!!activeElt.shadowRoot) { + activeElt = activeElt.shadowRoot.activeElement + } log("Clippings/wx::content.js: handleRequestInsertClipping(): activeElt = " + (activeElt ? activeElt.toString() : "???"));