File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
packages/uui-popover-container/lib Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ export class UUIPopoverContainerElement extends LitElement {
359359 style = getComputedStyle ( el ) ;
360360
361361 if ( excludeStaticParent && style . position === 'static' ) {
362+ el = this . #getAncestorElement( el ) ;
362363 continue ;
363364 }
364365 if (
@@ -370,16 +371,20 @@ export class UUIPopoverContainerElement extends LitElement {
370371 return ;
371372 }
372373
373- if ( el . parentElement ) {
374- el = el . parentElement ;
375- } else {
376- // If we had no parentElement, then check for shadow roots:
377- el = ( el . getRootNode ( ) as any ) ?. host ;
378- }
374+ el = this . #getAncestorElement( el ) ;
379375 }
380376 this . #scrollParents. push ( document . body ) ;
381377 }
382378
379+ #getAncestorElement( el : HTMLElement | null ) : HTMLElement | null {
380+ if ( el ?. parentElement ) {
381+ return el . parentElement ;
382+ } else {
383+ // If we had no parentElement, then check for shadow roots:
384+ return ( el ?. getRootNode ( ) as any ) ?. host ;
385+ }
386+ }
387+
383388 render ( ) {
384389 return html `<slot> </ slot> ` ;
385390 }
You can’t perform that action at this time.
0 commit comments