Pomax / react-onclickoutside

An onClickOutside wrapper for React components
MIT License
1.83k stars 187 forks source link

feat: Make lib work with shadow dom - use composedPath #324

Closed newying61 closed 3 years ago

newying61 commented 5 years ago

@Pomax , @cameronbraid Hi, this is a possible solution for making lib work inside shadowDOM.

I added tests.js which renders react app inside a shadow DOM.

Got an error when build the project. Will look into it later.

mbIkola commented 5 years ago

Got an error when build the project. Will look into it later.

warnings option added to a wrong place.

Following patch should fix your build:

diff --git a/rollup.config.js b/rollup.config.js
index 9f59da4..dcc9e01 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -39,9 +39,9 @@ const prodUmdConfig = mergeAll([
         compress: {
           pure_getters: true,
           unsafe: true,
-          unsafe_comps: true,
-          warnings: false,
+          unsafe_comps: true
         },
+        warnings: true
       })
     ),
   },

Details: UglifyJS compress options and minify options

newying61 commented 5 years ago

@mbIkola Thanks for the advice. Will update next week.

newying61 commented 5 years ago

@mbIkola Thanks. Build succeeded. Tests all passed.

By the way, any reason using closed mode shadow DOM? Like avoid abusing .shadowRoot? There is really little benefit we can get from { mode: 'closed' }.

fedelocci commented 5 years ago

Sorry guys, there's news for this PR. Thanks

newying61 commented 5 years ago

@fedelocci thanks.

dvasconcelos1 commented 4 years ago

Come on guys, let's merge this...

sagyos commented 4 years ago

Hi guys are you going to merge this soon? @MateuszKrazek

snasirca commented 4 years ago

Please merge this soon as we need it as well for react-datepicker

nouman91 commented 4 years ago

Guys any update on this, we have major developed and this is the blocker we ran into. Please merge it. Thank you.

Pomax commented 3 years ago

closing due to inactivity - mine, mostly, and unless someone is willing to fund me working on this again, that's unlikely to change.