diff --git a/src/shared/ui/menu/index.tsx b/src/shared/ui/menu/index.tsx index d02f806..fb637d5 100644 --- a/src/shared/ui/menu/index.tsx +++ b/src/shared/ui/menu/index.tsx @@ -203,6 +203,23 @@ export const Menu = ({ setEditMode(favoriteEdit) } },[favoriteEdit]); + + // 메뉴가 열릴 때 초기화 + useEffect(() => { + if (menuOn) { + // 스크롤 위치 초기화 + if (scrollRef.current) { + scrollRef.current.scrollTop = 0; + } + if (shortBtnScrollRef.current) { + shortBtnScrollRef.current.scrollLeft = 0; + } + // 선택된 버튼 인덱스 초기화 + setShortBtnIdx(0); + // lastScrollTop 초기화 + lastScrollTop.current = 0; + } + }, [menuOn]); return ( <>