You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to use the shadow DOM to create the chrome extension, and I use react-shadow to do this.
importReact,{useState,useEffect}from'react';importrootfrom'react-shadow';importOutsideClickHandlerfrom'react-outside-click-handler';import{Component}from'./component';constApp=()=>{return(<root.div><OutsideClickHandleronOutsideClick={()=>{// e.g.) close component}}><Component/></OutsideClickHandler></root.div>);};
If the code looks like the above, I want onOutSideClick to be executed when you click outside of the Component.
I don't think that's possible; OutsideClickHandler works via event bubbling, and the shadow DOM (i believe) disrupts that.
In other words, you'd have to, totally separately, install a click listener on the outer document body (ie, conceptually "wrap" it with OutsideClickHandler).
I'm adding an element under the shadow root in the chrome extension, but in that case, the element in the shadow DOM is determined to be outside.
How can I deal with this problem?
The text was updated successfully, but these errors were encountered: