Skip to content

Commit 9ab17e6

Browse files
authored
hotfix: close modals when url changes drastically (#19466)
* close modals when router disconnectes * correct comment * reorder code
1 parent 50f6024 commit 9ab17e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/router/route/router-slot.element.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ export class UmbRouterSlotElement extends UmbLitElement {
9595
}
9696

9797
override disconnectedCallback() {
98-
super.disconnectedCallback();
9998
window.removeEventListener('navigationsuccess', this._onNavigationChanged);
10099
this.#listening = false;
100+
101+
// Close modals opened by this router slot.
102+
this.#routeContext._internal_modalRouterChanged(undefined);
103+
104+
super.disconnectedCallback();
101105
}
102106

103107
protected override firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {

0 commit comments

Comments
 (0)