fix(modal): prevent browser hang when using ModalController in Angular
Issue number: resolves internal
What is the current behavior?
When using ModalController to present a modal in Angular applications, the browser becomes non-responsive and hangs in some circumstances. This regression was introduced in #30544 with the addition of a MutationObserver that watches document.body with subtree: true to detect when a modal's parent element is removed from the DOM. For controller-based modals, this observer fires on every DOM mutation in the document, causing severe performance issues during Angular's change detection cycles.
What is the new behavior?
The MutationObserver for parent removal detection is now skipped for controller-based modals and when the cached parent is the app root (document.body or ion-app). These parents are never removed from the DOM, so observing them is unnecessary. This prevents the performance issues while still maintaining the parent removal detection behavior for inline modals with meaningful parent elements.
Does this introduce a breaking change?
- [ ] Yes
- [X] No
Other information
Current dev build:
8.7.12-dev.11765231260.1def96ab
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| ionic-framework | Preview | Comment | Dec 10, 2025 9:03pm |