From 726e91101af6d2fec424a2e0eee46b0a36aa5d2d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 2 Apr 2019 17:53:53 +0200 Subject: [PATCH] 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