diff --git a/core/src/App.svelte b/core/src/App.svelte index f716a76725..c1a4af8d2c 100644 --- a/core/src/App.svelte +++ b/core/src/App.svelte @@ -375,13 +375,18 @@ RoutingHelpers.addRouteChangeListener((path, eventDetail) => { const { withoutSync, preventContextUpdate } = eventDetail || {}; const pv = preservedViews; + // TODO: check if bookmarkable modal is interferring here if (!isValidBackRoute(pv, path)) { preservedViews = []; Iframe.removeInactiveIframes(node); } - for (let i = mfModalList.length; i--; ) { - closeModal(i); + + if (!mfModalList.some((item) => item.modalWC && item.mfModal?.displayed)) { + // close all modals as we are navigating away here + for (let i = mfModalList.length; i--; ) { + closeModal(i); + } } // remove backdrop @@ -933,6 +938,7 @@ }; const targetModal = mfModalList[index]; const rp = GenericHelpers.getRemotePromise(targetModal.mfModal.settings.onClosePromiseId); + if (targetModal && targetModal.modalIframe) { getUnsavedChangesModalPromise(targetModal.modalIframe.contentWindow).then( () => { @@ -1405,10 +1411,12 @@ rejectRemotePromise(); }); // close all modals to allow navigation to the non-special view - mfModalList.forEach((m, index) => { - // close modals - closeModal(index); - }); + let mfModalListLength = mfModalList.length; + while (mfModalListLength) { + mfModalListLength--; + // close modal + closeModal(mfModalListLength); + } closeSplitView(); closeDrawer(); diff --git a/core/src/services/web-components.js b/core/src/services/web-components.js index cf8add39dc..8297c095d0 100644 --- a/core/src/services/web-components.js +++ b/core/src/services/web-components.js @@ -98,9 +98,7 @@ class WebComponentSvcClass { return wc.extendedContext.nodeParams; }, setAnchor: anchor => { - if (!isSpecialMf) { - window.Luigi.routing().setAnchor(anchor); - } + window.Luigi.routing().setAnchor(anchor); }, getAnchor: () => { return window.Luigi.routing().getAnchor();