From 422a1f01a4070380eb168af6e916c4ce060c3585 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 23 Mar 2016 10:51:07 +0000 Subject: [PATCH] Limit check on scrollNode.scrollTop to keep firefox happy Turns out that Firefox ignores attempts to set scrollTop to Number.MAX_VALUE. Clip it to scrollHeight. --- 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 d11738b971..c539336fa7 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -443,10 +443,12 @@ module.exports = React.createClass({ var scrollNode = this._getScrollNode(); var prevScroll = scrollNode.scrollTop; - scrollNode.scrollTop = scrollTop; - // If this change generates a scroll event, we should not update the saved - // scroll state on it. See the comments in onScroll. + // FF ignores attempts to set scrollTop to very large numbers + scrollNode.scrollTop = Math.min(scrollTop, scrollNode.scrollHeight); + + // If this change generates a scroll event, we should not update the + // saved scroll state on it. See the comments in onScroll. // // If we *don't* expect a scroll event, we need to leave _lastSetScroll // alone, otherwise we'll end up ignoring a future scroll event which is