Skip to content

Commit ef46eaf

Browse files
authored
fix(angular): inline modals now add .ion-page class correctly (#24751)
resolves #24750
1 parent 0580d65 commit ef46eaf

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

angular/src/directives/overlays/modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export declare interface IonModal extends Components.IonModal {
7373
@Component({
7474
selector: 'ion-modal',
7575
changeDetection: ChangeDetectionStrategy.OnPush,
76-
template: `<ng-container [ngTemplateOutlet]="template" *ngIf="isCmpOpen"></ng-container>`,
76+
template: `<div class="ion-page"><ng-container [ngTemplateOutlet]="template" *ngIf="isCmpOpen"></ng-container></div>`,
7777
inputs: [
7878
'animated',
7979
'backdropBreakpoint',

angular/test/test-app/e2e/src/modal.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@ describe('Modals: Inline', () => {
6060
cy.get('ion-list ion-item:nth-child(3)').should('have.text', 'C');
6161
cy.get('ion-list ion-item:nth-child(4)').should('have.text', 'D');
6262
});
63+
64+
it('should have a div with .ion-page', () => {
65+
cy.get('ion-modal').children('.ion-page').should('exist');
66+
});
6367
});

core/src/utils/framework-delegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const CoreDelegate = () => {
8989
BaseComponent.appendChild(el);
9090

9191
await new Promise(resolve => componentOnReady(el, resolve));
92-
} else {
92+
} else if (BaseComponent.children.length > 0) {
9393
// If there is no component, then we need to create a new parent
9494
// element to apply the css classes to.
9595
const el = BaseComponent.ownerDocument && BaseComponent.ownerDocument.createElement('div');

0 commit comments

Comments
 (0)