[shoptime-6105] Home / Live / Shop Now 상품 진입 후 이전버튼으로 Home으로 돌아갈 경우 포커싱 사라짐
This commit is contained in:
@@ -131,6 +131,8 @@ const HomePanel = ({ isOnTop }) => {
|
||||
const isInitialRender = useRef(true);
|
||||
const verticalPagenatorRef = useRef(null);
|
||||
const currentSentMenuRef = useRef(null);
|
||||
const lastRestoredIdRef = useRef(null);
|
||||
const prevIsOnTopRef = useRef(isOnTop);
|
||||
|
||||
useEffect(() => {
|
||||
if (nowMenu === "Home/Top") {
|
||||
@@ -562,14 +564,21 @@ const HomePanel = ({ isOnTop }) => {
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
const justCameBack = !prevIsOnTopRef.current && isOnTop;
|
||||
|
||||
if (
|
||||
isOnTop &&
|
||||
justCameBack &&
|
||||
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(() => {
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user