Skip to content

Commit d1df519

Browse files
committed
fix: scrollable calls onScrolledToBottom only when container is overflowing
1 parent 79d92a8 commit d1df519

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

polaris-react/src/components/Scrollable/Scrollable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function Scrollable({
6767

6868
requestAnimationFrame(() => {
6969
const {scrollTop, clientHeight, scrollHeight} = currentScrollArea;
70+
const canScroll = Boolean(scrollHeight > clientHeight);
7071
const isBelowTopOfScroll = Boolean(scrollTop > 0);
7172
const isAtBottomOfScroll = Boolean(
7273
scrollTop + clientHeight >= scrollHeight - LOW_RES_BUFFER,
@@ -75,7 +76,7 @@ export function Scrollable({
7576
setTopShadow(isBelowTopOfScroll);
7677
setBottomShadow(!isAtBottomOfScroll);
7778

78-
if (isAtBottomOfScroll && onScrolledToBottom) {
79+
if (canScroll && isAtBottomOfScroll && onScrolledToBottom) {
7980
onScrolledToBottom();
8081
}
8182
});

0 commit comments

Comments
 (0)