File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -272,19 +272,23 @@ export function generateTrigger(
272272 const originChildProps = child ?. props || { } ;
273273 const cloneProps : typeof originChildProps = { } ;
274274
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+
275284 const inPopupOrChild = useEvent ( ( ele : EventTarget ) => {
276285 const childDOM = targetEle ;
277286
278287 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 ) ,
288292 )
289293 ) ;
290294 } ) ;
You can’t perform that action at this time.
0 commit comments