From 999a05307e031b06f27b5a5cbd062021c90f5eab Mon Sep 17 00:00:00 2001 From: zty Date: Sat, 9 Mar 2024 14:09:31 +0800 Subject: [PATCH] fix: body overflow styles #3056 Co-authored-by: zty --- web/src/components/Dialog/BaseDialog.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/components/Dialog/BaseDialog.tsx b/web/src/components/Dialog/BaseDialog.tsx index 27df8fad..50e13b59 100644 --- a/web/src/components/Dialog/BaseDialog.tsx +++ b/web/src/components/Dialog/BaseDialog.tsx @@ -73,6 +73,7 @@ export function generateDialog( const tempDiv = document.createElement("div"); const dialog = createRoot(tempDiv); document.body.append(tempDiv); + document.body.style.overflow = "hidden"; setTimeout(() => { tempDiv.firstElementChild?.classList.add("showup"); @@ -82,6 +83,7 @@ export function generateDialog( destroy: () => { tempDiv.firstElementChild?.classList.remove("showup"); tempDiv.firstElementChild?.classList.add("showoff"); + document.body.style.removeProperty("overflow"); setTimeout(() => { dialog.unmount(); tempDiv.remove();