From 5105aef9997253b8bd6de9370e1b6fe64352e9aa Mon Sep 17 00:00:00 2001 From: Reliaaa <146612450+Reliaaaa@users.noreply.github.com> Date: Tue, 10 Nov 2026 22:17:01 +0700 Subject: [PATCH] Keep menu toggle stable through curtain exit --- src/App.jsx | 12 ++++++++---- src/styles.css | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 312a2ea..af07d87 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -61,7 +61,9 @@ export default function App() { const reducedMotion = useReducedMotion(); const [intro, setIntro] = useState(() => !window.matchMedia('(prefers-reduced-motion: reduce)').matches); const [menuOpen, setMenuOpen] = useState(false); - const [menuClosing, setMenuClosing] = useState(false); + const [menuClosing, setMenuClosing] = useState(false); + const [curtainClosing, setCurtainClosing] = useState(false); + const curtainTimer = useRef(null); const menuCloseTimer = useRef(null); const [activeProject, setActiveProject] = useState(null); const menuRef = useRef(null); @@ -168,12 +170,14 @@ export default function App() { } setMenuClosing(true); menuCloseTimer.current = window.setTimeout(() => { + setCurtainClosing(true); + curtainTimer.current = window.setTimeout(() => setCurtainClosing(false), 900); setMenuOpen(false); setMenuClosing(false); menuCloseTimer.current = null; }, 850); }, [reducedMotion]); - useEffect(() => () => window.clearTimeout(menuCloseTimer.current), []); + useEffect(() => () => { window.clearTimeout(menuCloseTimer.current); window.clearTimeout(curtainTimer.current); }, []); useEffect(() => { if (!menuOpen) return; menuRef.current?.focus({ preventScroll: true }); @@ -271,8 +275,8 @@ export default function App() {
{ setIntro(false); document.getElementById('main')?.focus({ preventScroll: true }); }}>Skip to content