ShopTime-4011 수정 및 onSaleNav 포커싱및 스크롤이동안되는 문제 추가수수정

This commit is contained in:
Dev TWIN0906
2025-06-05 15:27:06 +09:00
parent 04dd67803d
commit d1351ab442
2 changed files with 14 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ import TScroller from "../../../components/TScroller/TScroller";
import useScrollTo from "../../../hooks/useScrollTo"; import useScrollTo from "../../../hooks/useScrollTo";
import css from "./OnSaleNav.module.less"; import css from "./OnSaleNav.module.less";
import OnSaleNavItem from "./OnSaleNavItem/OnSaleNavItem"; import OnSaleNavItem from "./OnSaleNavItem/OnSaleNavItem";
import Spotlight from "@enact/spotlight";
const Container = SpotlightContainerDecorator( const Container = SpotlightContainerDecorator(
{ leaveFor: { right: "" }, enterTo: "last-focused" }, { leaveFor: { right: "" }, enterTo: "last-focused" },
@@ -59,22 +60,27 @@ export default function OnSaleNav({
const x = offsetFromContainerLeft - containerWidth + clippedWidth; const x = offsetFromContainerLeft - containerWidth + clippedWidth;
scrollLeft({ x }); setTimeout(() => {
scrollLeft({ x });
}, 100);
} }
} }
}, [panelInfoLgCatCd, scrollLeft]); }, [panelInfoLgCatCd, scrollLeft]);
useEffect(() => { useEffect(() => {
if (panelInfoLgCatCd && previousPanelIsDetail) { if (panelInfoLgCatCd) {
const node = document // const node = document.querySelector(
.querySelector(`[data-spotlight-id=spotlightId-${panelInfoLgCatCd}]`); `[data-spotlight-id=spotlightId-${panelInfoLgCatCd}]`
);
if (node) { if (node) {
const containerId = "on-sale-nav"; const containerId = "on-sale-nav";
setContainerLastFocusedElement(node, [containerId]); setContainerLastFocusedElement(node, [containerId]);
} }
setTimeout(() => {
Spotlight.focus(node);
}, 100);
} }
}, [panelInfoLgCatCd, previousPanelIsDetail]); }, [panelInfoLgCatCd]);
return ( return (
<Container <Container

View File

@@ -107,13 +107,9 @@ export default function OnSalePanel({ panelInfo, spotlightId }) {
if (categoryInfos) { if (categoryInfos) {
dispatch(copyCategoryInfos(categoryInfos)); dispatch(copyCategoryInfos(categoryInfos));
setCategories(categoryInfos); setCategories(categoryInfos);
if (!selectedLgCatCd && !selectedLgCatNm) { setSelectedLgCatCd(panelInfo?.lgCatCd);
setSelectedLgCatCd(categoryInfos[0].lgCatCd); setSelectedLgCatNm(panelInfo?.lgCatNm);
setSelectedLgCatNm(categoryInfos[0].lgCatNm);
}
} }
setSelectedLgCatCd(panelInfo?.lgCatCd);
setSelectedLgCatNm(panelInfo?.lgCatNm);
} }
}, [ }, [
categories, categories,