diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index 49c7f5f1..a3174c99 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -2060,25 +2060,41 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props // PlayerPanel이 최상단이 될 때 오버레이 표시 (DetailPanel에서 복귀) useEffect(() => { if (isOnTop && !panelInfo.modal && !videoVerticalVisible) { - console.log('[PlayerPanel] ✅ DetailPanel에서 복귀함! - 오버레이 표시'); + // launchedFromPlayer가 있는지 확인하여 HomePanel 복귀와 PlayerPanel 내부 DetailPanel 복귀 구분 + const hasLaunchedFromPlayer = panelInfo?.lastFocusedTargetId !== undefined; + + if (hasLaunchedFromPlayer) { + console.log('[PlayerPanel] ✅ PlayerPanel 내부 DetailPanel에서 복귀함! - 오버레이 표시'); + } else { + console.log('[PlayerPanel] 📺 HomePanel에서 복귀함 - 오버레이 표시'); + // HomePanel에서 복귀 시 항상 tabIndex=1로 시작 + console.log('[PlayerPanel] 🔄 HomePanel 복귀 - tabIndex를 1로 강제 설정'); + if (tabContainerVersion === 2) { + setTabIndexV2(1); + console.log('[PlayerPanel] 📝 tabIndexV2를 1로 설정됨'); + } + } + setSideContentsVisible(true); - console.log('[setBelowContentsVisible] DetailPanel에서 복귀 - true로 변경'); + console.log('[setBelowContentsVisible] 복귀 - true로 변경'); setBelowContentsVisible(true); // VideoPlayer가 belowContentsVisible prop을 감지해서 자동으로 controls 표시함 - // DetailPanel에서 복귀 시 포커스 복원 시도 - const lastFocusedTargetId = panelInfo?.lastFocusedTargetId; - console.log('[PlayerPanel] 🎯 DetailPanel 복귀 - lastFocusedTargetId:', lastFocusedTargetId); + // PlayerPanel 내부 DetailPanel에서 복귀 시에만 포커스 복원 시도 + if (hasLaunchedFromPlayer) { + const lastFocusedTargetId = panelInfo?.lastFocusedTargetId; + console.log('[PlayerPanel] 🎯 PlayerPanel DetailPanel 복귀 - lastFocusedTargetId:', lastFocusedTargetId); - if (lastFocusedTargetId) { - // ShopNowContents가 렌더링될 때까지 잠시 대기 후 포커스 복원 - setTimeout(() => { - console.log('[PlayerPanel] 🔍 500ms 후 포커스 복원 시도:', lastFocusedTargetId); - Spotlight.focus(lastFocusedTargetId); - }, 500); + if (lastFocusedTargetId) { + // ShopNowContents가 렌더링될 때까지 잠시 대기 후 포커스 복원 + setTimeout(() => { + console.log('[PlayerPanel] 🔍 500ms 후 포커스 복원 시도:', lastFocusedTargetId); + Spotlight.focus(lastFocusedTargetId); + }, 500); + } } } - }, [isOnTop, panelInfo.modal, videoVerticalVisible, panelInfo?.lastFocusedTargetId]); + }, [isOnTop, panelInfo.modal, videoVerticalVisible, panelInfo?.lastFocusedTargetId, tabContainerVersion, setTabIndexV2]); useEffect(() => { // tabContainerVersion === 1일 때만 실행