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.
pull/21833/head
Richard van der Hoff 2016-03-23 10:51:07 +00:00
parent cf17258a6c
commit 422a1f01a4
1 changed files with 5 additions and 3 deletions

View File

@ -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