From f043107f87e9db6298b7456eeb01df0c8c0ecb87 Mon Sep 17 00:00:00 2001 From: HeagBoKaT Date: Fri, 29 May 2026 14:59:33 +0300 Subject: [PATCH] Fix modal scroll shift: add width:100% to body lock --- client/src/components/CatModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/CatModal.tsx b/client/src/components/CatModal.tsx index 839119a..8c080ed 100644 --- a/client/src/components/CatModal.tsx +++ b/client/src/components/CatModal.tsx @@ -35,17 +35,19 @@ export default function CatModal({ catId, onClose }: CatModalProps) { useEffect(() => { if (data?.cat) setLikeCount(data.cat.likes_count); }, [data]); useEffect(() => { const scrollY = window.scrollY; + document.body.style.overflow = 'hidden'; document.body.style.position = 'fixed'; document.body.style.top = `-${scrollY}px`; document.body.style.left = '0'; document.body.style.right = '0'; - document.body.style.overflow = 'hidden'; + document.body.style.width = '100%'; return () => { + document.body.style.overflow = ''; document.body.style.position = ''; document.body.style.top = ''; document.body.style.left = ''; document.body.style.right = ''; - document.body.style.overflow = ''; + document.body.style.width = ''; window.scrollTo(0, scrollY); }; }, []);