File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/uui-popover-container/lib Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -332,8 +332,8 @@ export class UUIPopoverContainerElement extends LitElement {
332332 ? / ( a u t o | s c r o l l | h i d d e n ) /
333333 : / ( a u t o | s c r o l l ) / ;
334334
335- let el = this . #targetElement;
336- while ( ( el = el . parentElement as HTMLElement ) ) {
335+ let el : HTMLElement | undefined | null = this . #targetElement;
336+ while ( el ) {
337337 style = getComputedStyle ( el ) ;
338338
339339 if ( excludeStaticParent && style . position === 'static' ) {
@@ -347,6 +347,13 @@ export class UUIPopoverContainerElement extends LitElement {
347347 if ( style . position === 'fixed' ) {
348348 return ;
349349 }
350+
351+ if ( el . parentElement ) {
352+ el = el . parentElement ;
353+ } else {
354+ // If we had no parentElement, then check for shadow roots:
355+ el = ( el . getRootNode ( ) as any ) ?. host ;
356+ }
350357 }
351358 this . #scrollParents. push ( document . body ) ;
352359 }
You can’t perform that action at this time.
0 commit comments