File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -272,19 +272,23 @@ export function generateTrigger(
272
272
const originChildProps = child ?. props || { } ;
273
273
const cloneProps : typeof originChildProps = { } ;
274
274
275
+ const inContainer = ( container : Element , target : Element ) => {
276
+ return (
277
+ target === container ||
278
+ container . contains ( target ) ||
279
+ getShadowRoot ( container ) ?. host === target ||
280
+ container . contains ( getShadowRoot ( target ) ?. host )
281
+ ) ;
282
+ } ;
283
+
275
284
const inPopupOrChild = useEvent ( ( ele : EventTarget ) => {
276
285
const childDOM = targetEle ;
277
286
278
287
return (
279
- childDOM ?. contains ( ele as HTMLElement ) ||
280
- getShadowRoot ( childDOM ) ?. host === ele ||
281
- ele === childDOM ||
282
- popupEle ?. contains ( ele as HTMLElement ) ||
283
- getShadowRoot ( popupEle ) ?. host === ele ||
284
- ele === popupEle ||
285
- Object . values ( subPopupElements . current ) . some (
286
- ( subPopupEle ) =>
287
- subPopupEle ?. contains ( ele as HTMLElement ) || ele === subPopupEle ,
288
+ inContainer ( childDOM , ele as Element ) ||
289
+ inContainer ( popupEle , ele as Element ) ||
290
+ Object . values ( subPopupElements . current ) . some ( ( subPopupEle ) =>
291
+ inContainer ( subPopupEle , ele as Element ) ,
288
292
)
289
293
) ;
290
294
} ) ;
You can’t perform that action at this time.
0 commit comments