Skip to content

Commit 0c4a93e

Browse files
committed
use first container child for calculating top position
1 parent f5ee3f8 commit 0c4a93e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

assets/js/phoenix_live_view/hooks.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ Hooks.InfiniteScroll = {
218218
scrollBefore = scrollNow;
219219
return pendingOp();
220220
}
221-
const rect = this.el.getBoundingClientRect();
221+
const rect = this.scrollContainer
222+
? this.scrollContainer.firstElementChild.getBoundingClientRect()
223+
: this.el.getBoundingClientRect();
222224
const topEvent = this.el.getAttribute(
223225
this.liveSocket.binding("viewport-top"),
224226
);

0 commit comments

Comments
 (0)