[251026] fix: SearchResults.new.v2 last Item focus
🕐 커밋 시간: 2025. 10. 26. 15:22:27 📊 변경 통계: • 총 파일: 1개 • 추가: +10줄 • 삭제: -2줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/views/SearchPanel/SearchResults.new.v2.jsx
This commit is contained in:
@@ -276,9 +276,17 @@ const SearchResultsNew = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setVisibleCount((prev) => {
|
setVisibleCount((prev) => {
|
||||||
const nextIndex = prev; // 새로 추가될 첫 번째 상품 인덱스
|
|
||||||
setPendingFocusIndex(nextIndex);
|
|
||||||
const nextCount = Math.min(prev + ITEMS_PER_PAGE, totalLength);
|
const nextCount = Math.min(prev + ITEMS_PER_PAGE, totalLength);
|
||||||
|
// 다음 로드 후 마지막 페이지가 될 것인지 확인
|
||||||
|
const willBeLastLoad = nextCount >= totalLength;
|
||||||
|
|
||||||
|
// 마지막 로드이면 마지막 아이템에, 아니면 새로 추가될 첫 아이템에 포커스
|
||||||
|
if (willBeLastLoad) {
|
||||||
|
setPendingFocusIndex(totalLength - 1); // 마지막 아이템 인덱스
|
||||||
|
} else {
|
||||||
|
setPendingFocusIndex(prev); // 새로 추가될 첫 아이템 인덱스
|
||||||
|
}
|
||||||
|
|
||||||
return nextCount;
|
return nextCount;
|
||||||
});
|
});
|
||||||
}, [hasMore, currentData]);
|
}, [hasMore, currentData]);
|
||||||
|
|||||||
Reference in New Issue
Block a user