From c6b821a35145d9bc1a08a184d69061df67dc4b55 Mon Sep 17 00:00:00 2001 From: Jay Sheen Date: Mon, 3 Nov 2025 14:08:45 +0900 Subject: [PATCH] Improve menu category selection when scrolling to bottom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatically select the last category when the user scrolls to the bottom of the menu list. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/shared/ui/menu/index.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/shared/ui/menu/index.tsx b/src/shared/ui/menu/index.tsx index 643c996..6679fd6 100644 --- a/src/shared/ui/menu/index.tsx +++ b/src/shared/ui/menu/index.tsx @@ -218,8 +218,22 @@ export const Menu = ({ const menuListScroll = () => { if (isButtonScrolling.current) return; - const scrollTop = scrollRef.current?.scrollTop || 0; - const currentIndex = getCurrentCategoryIndex(scrollTop); + if (!scrollRef.current) return; + + const scrollTop = scrollRef.current.scrollTop; + const scrollHeight = scrollRef.current.scrollHeight; + const clientHeight = scrollRef.current.clientHeight; + + // ์Šคํฌ๋กค์ด ๋งจ ๋ฐ‘์— ๋„๋‹ฌํ–ˆ๋Š”์ง€ ํ™•์ธ (์•ฝ๊ฐ„์˜ ์˜ค์ฐจ ํ—ˆ์šฉ) + const isAtBottom = scrollHeight - scrollTop - clientHeight < 1; + + let currentIndex: number; + if (isAtBottom) { + // ๋งจ ๋ฐ‘์ด๋ฉด ๋งˆ์ง€๋ง‰ ์นดํ…Œ๊ณ ๋ฆฌ ์„ ํƒ + currentIndex = buttonRefs.current.length - 1; + } else { + currentIndex = getCurrentCategoryIndex(scrollTop); + } if (currentIndex !== shortBtnIdx) { setShortBtnIdx(currentIndex);