diff --git a/src/lib.tsx b/src/lib.tsx index 3d09b11..09cf9d8 100644 --- a/src/lib.tsx +++ b/src/lib.tsx @@ -24,6 +24,7 @@ class GooeyEmbedFactory { } const innerDiv = document.createElement("div"); innerDiv.style.display = "contents"; + innerDiv.className = "inner-div"; if(targetElem.children.length > 0) targetElem.removeChild(targetElem.children[0]); targetElem.appendChild(innerDiv); const root = renderCopilotChatWidget(innerDiv, config); diff --git a/src/widgets/copilot/components/widget/index.tsx b/src/widgets/copilot/components/widget/index.tsx index 4108c18..eeb3221 100644 --- a/src/widgets/copilot/components/widget/index.tsx +++ b/src/widgets/copilot/components/widget/index.tsx @@ -22,7 +22,7 @@ const CopilotWidget: FC = ({ isInline }) => { const handleEditClick = () => { cancelApiCall(); flushData(); - const shadowRoot = document.getElementById(isInline ? "inline" : "popup")?.firstElementChild?.shadowRoot; + const shadowRoot = document.getElementById(isInline ? "inline" : "popup")?.getElementsByClassName("inner-div")[0]?.shadowRoot; const ele = shadowRoot?.getElementById(CHAT_INPUT_ID); ele?.focus(); };