From 76eafceee84205d7a9860f6e23d328c134a001db Mon Sep 17 00:00:00 2001 From: jwkim Date: Fri, 19 Jun 2026 09:10:54 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=A0=EC=A7=9C=EB=B3=84=20=EC=B9=A9=20?= =?UTF-8?q?=EC=B2=AB=20=EC=A7=84=EC=9E=85=20=EC=8B=9C=20=EC=98=A4=EB=8A=98?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=20=EA=B0=80=EC=9A=B4=EB=8D=B0=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ScheduleBoard.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ScheduleBoard.tsx b/frontend/src/components/ScheduleBoard.tsx index 8ee2841..556f8a9 100644 --- a/frontend/src/components/ScheduleBoard.tsx +++ b/frontend/src/components/ScheduleBoard.tsx @@ -141,10 +141,16 @@ function ChipScroller({ setAtEnd(el.scrollLeft >= max - 1); }; - // 탭/목록 변경 시 맨 앞으로 + 재측정 (레이아웃 확정 후) + // 탭/목록 변경 시: 선택된 칩을 가운데로 + 재측정 (레이아웃 확정 후) + // 선택 칩이 없으면 맨 앞으로 되감는다. useLayoutEffect(() => { const el = ref.current; - if (el) el.scrollLeft = 0; + if (el) { + const active = el.querySelector('[data-active="true"]'); + el.scrollLeft = active + ? active.offsetLeft - (el.clientWidth - active.clientWidth) / 2 + : 0; + } measure(); }, [resetKey]); @@ -212,6 +218,7 @@ function Chip({ return (