File tree Expand file tree Collapse file tree
core/src/components/modal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1464,10 +1464,18 @@ export class Modal implements ComponentInterface, OverlayInterface {
14641464 // Check for standard Ionic layout children (ion-content, ion-footer),
14651465 // searching one level deep for wrapped components (e.g.,
14661466 // <app-footer><ion-footer>...</ion-footer></app-footer>).
1467- // Uses :scope to limit the search depth rather than matching deeply
1468- // nested elements inside inner modals or other overlays.
1469- const hasContent = el . querySelector ( ':scope > ion-content, :scope > * > ion-content' ) !== null ;
1470- const hasFooter = el . querySelector ( ':scope > ion-footer, :scope > * > ion-footer' ) !== null ;
1467+ // Note: uses a manual loop instead of querySelector(':scope > ...') because
1468+ // Stencil's mock-doc (used in spec tests) does not support :scope.
1469+ let hasContent = false ;
1470+ let hasFooter = false ;
1471+ for ( const child of Array . from ( el . children ) ) {
1472+ if ( child . tagName === 'ION-CONTENT' ) hasContent = true ;
1473+ if ( child . tagName === 'ION-FOOTER' ) hasFooter = true ;
1474+ for ( const grandchild of Array . from ( child . children ) ) {
1475+ if ( grandchild . tagName === 'ION-CONTENT' ) hasContent = true ;
1476+ if ( grandchild . tagName === 'ION-FOOTER' ) hasFooter = true ;
1477+ }
1478+ }
14711479
14721480 // Only apply wrapper padding for standard Ionic layouts (has ion-content
14731481 // but no ion-footer). Custom modals with raw HTML are fully
You can’t perform that action at this time.
0 commit comments