This commit is contained in:
Viet An
2026-07-09 17:22:19 +07:00
parent 9b77644e8d
commit 22854bb4fb
9 changed files with 104 additions and 77 deletions

View File

@@ -141,13 +141,18 @@ function closeOnEsc(e) {
onMounted(() => {
window.addEventListener("keydown", closeOnEsc);
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
document.documentElement.style.cssText += ` ;padding-right: ${scrollbarWidth}px;`;
document.documentElement.classList.add("is-clipped");
});
onUnmounted(() => {
window.removeEventListener("keydown", closeOnEsc);
const remaining = document.getElementsByClassName("modal-background").length;
if (remaining === 0) document.documentElement.classList.remove("is-clipped");
if (remaining === 0) {
document.documentElement.classList.remove("is-clipped");
document.documentElement.style.removeProperty("padding-right");
}
});
const loaded = ref(false);