Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2846 from matrix-org/bwindels/atbottomfix
Browse files Browse the repository at this point in the history
round scrollTop upwards to prevent never detecting bottom
  • Loading branch information
bwindels committed Mar 29, 2019
2 parents 1f084b2 + 8e4a06d commit e7852ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/structures/ScrollPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7852ad

Please sign in to comment.