Skip to content

Commit 2cc4a5c

Browse files
committed
fix(modal): trigger view transition manually on cleanup to ensure we're in the right state
1 parent 67f1d05 commit 2cc4a5c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/components/modal/modal.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
10441044
}
10451045

10461046
private cleanupViewTransitionListener() {
1047+
const hasCardView = !!this.resizeListener;
10471048
if (this.resizeListener) {
10481049
window.removeEventListener('resize', this.resizeListener);
10491050
this.resizeListener = undefined;
@@ -1053,6 +1054,15 @@ export class Modal implements ComponentInterface, OverlayInterface {
10531054
this.viewTransitionAnimation.destroy();
10541055
this.viewTransitionAnimation = undefined;
10551056
}
1057+
1058+
if (hasCardView) {
1059+
// If we had a card view, let's trigger the view transition
1060+
// one last time to make sure we're in the right state.
1061+
// This will prevent tricky things like resizing the modal causing
1062+
// it to dismiss programatically too quickly and preventing the view transition
1063+
// from being applied.
1064+
this.handleViewTransition();
1065+
}
10561066
}
10571067

10581068
render() {

0 commit comments

Comments
 (0)