From 726e91101af6d2fec424a2e0eee46b0a36aa5d2d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 2 Apr 2019 17:53:53 +0200 Subject: [PATCH 1/3] allow fractional values for scrollTop above and below expected value --- src/components/structures/ScrollPanel.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index cbbca3c468..c3c13b8a11 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -222,10 +222,12 @@ module.exports = React.createClass({ // whether it will stay that way when the children update. isAtBottom: function() { const sn = this._getScrollNode(); - // fractional values for scrollTop happen on certain browsers/platforms + // fractional values (both too big and too small) + // for scrollTop happen on certain browsers/platforms // when scrolled all the way down. E.g. Chrome 72 on debian. - // so ceil everything upwards to make sure it aligns. - return Math.ceil(sn.scrollTop) === Math.ceil(sn.scrollHeight - sn.clientHeight); + // so check difference <= 1; + return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1; + }, // returns the vertical height in the given direction that can be removed from From 86c13b97ce1bcff69470a8f70bf0f86b8b4b000f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 2 Apr 2019 17:54:14 +0200 Subject: [PATCH 2/3] increase PAGE_SIZE so users can scroll up already while waiting for pag. --- src/components/structures/ScrollPanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index c3c13b8a11..cd9d68ae7e 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -30,7 +30,7 @@ const UNPAGINATION_PADDING = 6000; // many scroll events causing many unfilling requests. const UNFILL_REQUEST_DEBOUNCE_MS = 200; -const PAGE_SIZE = 200; +const PAGE_SIZE = 400; let debuglog; if (DEBUG_SCROLL) { From fee8d79267484c4ea33116861495bc4fe37c2df9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 3 Apr 2019 09:16:30 +0200 Subject: [PATCH 3/3] comment for PAGE_SIZE --- src/components/structures/ScrollPanel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index cd9d68ae7e..7e1f0ff469 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -29,7 +29,10 @@ const UNPAGINATION_PADDING = 6000; // The number of milliseconds to debounce calls to onUnfillRequest, to prevent // many scroll events causing many unfilling requests. const UNFILL_REQUEST_DEBOUNCE_MS = 200; - +// _updateHeight makes the height a ceiled multiple of this so we +// don't have to update the height too often. It also allows the user +// to scroll past the pagination spinner a bit so they don't feel blocked so +// much while the content loads. const PAGE_SIZE = 400; let debuglog;