unregister closed/destroyed overlay panels
This commit is contained in:
@@ -68,15 +68,9 @@
|
||||
}
|
||||
|
||||
$: if (active) {
|
||||
// add helper body class
|
||||
CommonHelper.pushUnique(activePanels, uniqueId);
|
||||
document.body.classList.add("overlay-active");
|
||||
registerActivePanel();
|
||||
} else {
|
||||
// remove helper body class if there are no other active panels
|
||||
CommonHelper.removeByValue(activePanels, uniqueId);
|
||||
if (!activePanels.length) {
|
||||
document.body.classList.remove("overlay-active");
|
||||
}
|
||||
unregisterActivePanel();
|
||||
}
|
||||
|
||||
export function show() {
|
||||
@@ -129,6 +123,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
function registerActivePanel() {
|
||||
CommonHelper.pushUnique(activePanels, uniqueId);
|
||||
|
||||
document.body.classList.add("overlay-active");
|
||||
}
|
||||
|
||||
function unregisterActivePanel() {
|
||||
CommonHelper.removeByValue(activePanels, uniqueId);
|
||||
|
||||
if (!activePanels.length) {
|
||||
document.body.classList.remove("overlay-active");
|
||||
}
|
||||
}
|
||||
|
||||
function highestZIndex() {
|
||||
return 1000 + getHolder().querySelectorAll(".overlay-panel-container.active").length;
|
||||
}
|
||||
@@ -196,14 +204,12 @@
|
||||
return () => {
|
||||
clearTimeout(contentScrollThrottle);
|
||||
|
||||
unregisterActivePanel();
|
||||
|
||||
// ensures that no artifacts remains
|
||||
// (currently there is a bug with svelte transition)
|
||||
wrapper?.classList?.add("hidden");
|
||||
|
||||
if (!activePanels.length) {
|
||||
document.body.classList.remove("overlay-active");
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
wrapper?.remove();
|
||||
}, 0);
|
||||
|
||||
Reference in New Issue
Block a user