diff --git a/packages/uikit/src/components/Overlay/Overlay.tsx b/packages/uikit/src/components/Overlay/Overlay.tsx index 08c4f2fbf971c..eff1125078a74 100644 --- a/packages/uikit/src/components/Overlay/Overlay.tsx +++ b/packages/uikit/src/components/Overlay/Overlay.tsx @@ -39,16 +39,20 @@ const StyledOverlay = styled(Box)<{ isUnmounting?: boolean }>` const BodyLock = () => { useEffect(() => { - document.body.style.cssText = ` + if (document?.body?.style) { + document.body.style.cssText = ` overflow: hidden; `; - document.body.style.overflow = "hidden"; - return () => { - document.body.style.cssText = ` + document.body.style.overflow = "hidden"; + return () => { + document.body.style.cssText = ` overflow: visible; overflow: overlay; `; - }; + }; + } + + return undefined; }, []); return null;