From b7bf2414d0116e3e0f9ad063bdd33776773c75c9 Mon Sep 17 00:00:00 2001 From: "younghoon100.park" Date: Mon, 14 Oct 2024 17:07:52 +0900 Subject: [PATCH] =?UTF-8?q?[SHOPTIME-3155]=20My=20Page=20/=20Recentrly=20V?= =?UTF-8?q?iewed=20/=20VOD=20=ED=81=B4=EB=A6=AD=20=ED=9B=84=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=20=ED=82=A4=20=EC=9E=85=EB=A0=A5=20=EC=8B=9C=20?= =?UTF-8?q?=ED=8F=AC=EC=BB=A4=EC=8A=A4=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed files: 1. RecentlyViewed.jsx Detail note: - 원인: DetailPanel에서 돌아올 때와 다르게 PlayerPanel에서 돌아올 경우, component가 unmounted되지 않기 때문에 focus 로직 동작 시 가장 가까운 node를 찾아 focus 함 - 대책: PlayerPanel에서 돌아올 경우, scroll을 top으로 설정하고, 그 이후 아이템에 포커스가 가도록 로직 변경 --- .../RecentlyViewed/RecentlyViewed.jsx | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/RecentlyViewed/RecentlyViewed.jsx b/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/RecentlyViewed/RecentlyViewed.jsx index 9452ffed..051c0825 100644 --- a/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/RecentlyViewed/RecentlyViewed.jsx +++ b/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/RecentlyViewed/RecentlyViewed.jsx @@ -61,17 +61,24 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) { useEffect(() => { if (recentlyDatas) { setTimeout(() => { - const node = document.querySelector(`[id="${SpotlightIds.TBODY}"]`); - if (activeDelete) { - Spotlight.focus("recentlyviewed_header"); - } else if (recentlyDatas.length === 0) { - Spotlight.focus("mypage-recentlyViewed-nodata"); - } else if (node) { - Spotlight.focus(node); + const tHeader = document.querySelector( + `[data-spotlight-id="recentlyviewed_header"]` + ); + const tBody = document.querySelector(`[id="${SpotlightIds.TBODY}"]`); + + if (isOnTop) { + if (cbChangePageRef.current) { + cbChangePageRef.current(0, false); + + if (tHeader && tBody) { + const focusTarget = activeDelete ? tHeader : tBody; + Spotlight.focus(focusTarget); + } + } } - }, 0); + }); } - }, [recentlyDatas]); + }, [isOnTop, recentlyDatas]); useEffect(() => { if (panelInfo) {