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

View File

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