From 8e4a06db77f22569568bcdf7a44d964ab0ff0268 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 29 Mar 2019 16:41:10 +0100 Subject: [PATCH] round scrollTop upwards to prevent never detecting bottom --- 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 bb01da03da1..cbbca3c468d 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -222,7 +222,10 @@ module.exports = React.createClass({ // whether it will stay that way when the children update. isAtBottom: function() { const sn = this._getScrollNode(); - return sn.scrollTop === sn.scrollHeight - sn.clientHeight; + // fractional values 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); }, // returns the vertical height in the given direction that can be removed from