Skip to content

bug: [Angular] inline ion-modal is not and cannot be dismissed when the parent component is destroyed #30389

Open
@distante

Description

@distante

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When opening an ion-modal inline, if the parent component gets destroyed when the modal is open, the modal is not dismissed nor destroyed

Expected Behavior

The modal should close when the parent component is destroyed

Steps to Reproduce

  1. Create an inline ion-modal inside a child-component
  2. Destroy the Child component (ngIf or similar)

Code Reproduction URL

https://stackblitz.com/edit/tmgkbwps

Ionic Info

Ionic:

Ionic CLI : 7.2.0
Ionic Framework : @ionic/angular 8.5.6
@angular-devkit/build-angular : 19.2.6
@angular-devkit/schematics : 19.2.6
@angular/cli : 19.2.6
@ionic/angular-toolkit : 11.0.1

Capacitor:

Capacitor CLI : 7.2.0
@capacitor/android : 7.2.0
@capacitor/core : 7.2.0
@capacitor/ios : not installed

Cordova:

Cordova CLI : not installed
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v20.18.3 (/Users/me/.volta/tools/image/node/20.18.3/bin/node)
npm : 10.8.2
OS : macOS Unknown

Additional Information

I have not found any workaround for this besides use some flag inside the parent component to "render the content", which is dangerous since we can not prevent a regular Angular if usage in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: investigationThis issue is waiting on more investigation from the Ionic Team.

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions