[SHOPTIME-3885] Keyword / 컨텐츠 없을 경우 포커싱 상이

[수정사항] NoSearchResults 랜더링되는 조건일때만 함수가 호출되도록 조건문 수정
This commit is contained in:
고동영
2025-01-02 15:02:33 +09:00
parent f5ab55a26e
commit 7ccfbc9d3e

View File

@@ -207,11 +207,21 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
}
};
const handleBestSellerItemFocus = useCallback(() => {
if (bestSellerDatas && bestSellerDatas.length > 0) {
Spotlight.focus(`spotlightId-${bestSellerDatas[0].prdtId}`);
}
}, [bestSellerDatas]);
const handleBestSellerItemFocus = useCallback(
(e) => {
if (
searchPerformed &&
searchQuery !== null &&
bestSellerDatas &&
bestSellerDatas.length > 0 &&
e.key === "ArrowDown" &&
Object.keys(searchDatas).length === 0
) {
Spotlight.focus(`spotlightId-${bestSellerDatas[0].prdtId}`);
}
},
[bestSellerDatas, searchDatas, searchPerformed, searchQuery]
);
const cursorPosition = () => {
const input = document.querySelector(