[shoptime-6105] Home / Live / Shop Now 상품 진입 후 이전버튼으로 Home으로 돌아갈 경우 포커싱 사라짐

This commit is contained in:
jiwon93.son
2025-11-18 16:30:26 +09:00
parent 71e1d2a897
commit 06e3978321
2 changed files with 26 additions and 17 deletions

View File

@@ -437,20 +437,19 @@ export default function RandomUnit({
// 비디오 클릭 // 비디오 클릭
const videoClick = useCallback(() => { const videoClick = useCallback(() => {
const lastFocusedTargetId = getContainerId(Spotlight.getCurrent());
const currentSpot = Spotlight.getCurrent(); const currentSpot = Spotlight.getCurrent();
if (lastFocusedTargetId) { const currentSpotlightId = currentSpot?.getAttribute("data-spotlight-id") || spotlightId;
dispatch(
updateHomeInfo({ dispatch(
name: panel_names.HOME_PANEL, updateHomeInfo({
panelInfo: { name: panel_names.HOME_PANEL,
lastFocusedTargetId, panelInfo: {
focusedContainerId: TEMPLATE_CODE_CONF.TOP, lastFocusedTargetId: currentSpotlightId,
currentSpot: currentSpot?.getAttribute("data-spotlight-id"), focusedContainerId: TEMPLATE_CODE_CONF.TOP,
}, currentSpot: currentSpotlightId,
}) },
); })
} );
dispatch( dispatch(
startVideoPlayer({ startVideoPlayer({
@@ -484,6 +483,7 @@ export default function RandomUnit({
randomDataRef, randomDataRef,
sendBannerLog, sendBannerLog,
onBlur, onBlur,
dispatch,
]); ]);
// 투데이즈 딜 가격 정보 // 투데이즈 딜 가격 정보

View File

@@ -131,6 +131,8 @@ const HomePanel = ({ isOnTop }) => {
const isInitialRender = useRef(true); const isInitialRender = useRef(true);
const verticalPagenatorRef = useRef(null); const verticalPagenatorRef = useRef(null);
const currentSentMenuRef = useRef(null); const currentSentMenuRef = useRef(null);
const lastRestoredIdRef = useRef(null);
const prevIsOnTopRef = useRef(isOnTop);
useEffect(() => { useEffect(() => {
if (nowMenu === "Home/Top") { if (nowMenu === "Home/Top") {
@@ -562,14 +564,21 @@ const HomePanel = ({ isOnTop }) => {
}, [dispatch]); }, [dispatch]);
useEffect(() => { useEffect(() => {
const justCameBack = !prevIsOnTopRef.current && isOnTop;
if ( if (
isOnTop && justCameBack &&
panelInfo?.lastFocusedTargetId && panelInfo?.lastFocusedTargetId &&
!panelInfo?.focusedContainerId panelInfo.lastFocusedTargetId !== lastRestoredIdRef.current
) { ) {
Spotlight.focus(panelInfo.lastFocusedTargetId); lastRestoredIdRef.current = panelInfo.lastFocusedTargetId;
setTimeout(() => {
Spotlight.focus(panelInfo.lastFocusedTargetId);
}, 150);
} }
}, [isOnTop, panelInfo?.lastFocusedTargetId, panelInfo?.focusedContainerId]);
prevIsOnTopRef.current = isOnTop;
}, [isOnTop, panelInfo?.lastFocusedTargetId]);
useEffect(() => { useEffect(() => {
return () => { return () => {