Umbraco.CMS.Backoffice
Umbraco.CMS.Backoffice copied to clipboard
[BUG]: Modal Route does not support navigation with browser history
I just notice that the behavior of the routed modal (UmbModalRouteRegistrationController
) is quite strange when clicking on the "back"-button in the browser.
The route changes in the address bar and the view "behind" the modal is changing - but the modal is still on top of everything.
In an ideal world there should be some kind of callback, like the onSetup()
, onReject()
to hook into the navigation and maybe prompt the user if "the thing" in the modal is not saved.
I played with some of the events from the router-slot
library but the route still changed.
window.addEventListener("willchangestate", e => {
// Check if we should navigate away from this page
if (!confirm("You have unsafed data. Do you wish to discard it?")) {
e.preventDefault();
return;
}
}, {once: true});