Skip to content

Commit ab78991

Browse files
committed
Merge branch 'main' into gh-pages
2 parents 45b0282 + 9b818b3 commit ab78991

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

demos/react/src/virtualized/VirtualTable.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ function VirtualTableBase<T>({
7070
return offset;
7171
}
7272
const scrollTop = viewport.scrollTop;
73-
const newPage = Math.floor(scrollTop * ((th - vp) / (h - vp)) * (1 / ph));
73+
const newPage = Math.max(
74+
Math.floor(scrollTop * ((th - vp) / (h - vp)) * (1 / ph)),
75+
0
76+
);
7477
setPage(newPage);
7578
const nextOffset = Math.round(newPage * cj);
7679
setOffset(nextOffset);
@@ -83,7 +86,7 @@ function VirtualTableBase<T>({
8386
if (!viewport) {
8487
return offset;
8588
}
86-
const scrollTop = viewport.scrollTop;
89+
const scrollTop = Math.max(viewport.scrollTop, 0);
8790

8891
// next page
8992
let nextOffset = offset;

0 commit comments

Comments
 (0)