From 66e41a450f23387e33e3ba537bd5bad5ebcf4ddd Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Sun, 24 May 2015 00:29:30 -0400 Subject: [PATCH] [fixed] Fix scroll top calculation for overlays Fixes #724 --- src/OverlayTrigger.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/OverlayTrigger.js b/src/OverlayTrigger.js index d40faedcd2..22a7f3d432 100644 --- a/src/OverlayTrigger.js +++ b/src/OverlayTrigger.js @@ -281,19 +281,21 @@ const OverlayTrigger = React.createClass({ _getContainerDimensions() { const containerNode = this.getContainerDOMNode(); - let width, height; + let width, height, scroll; + if (containerNode.tagName === 'BODY') { width = window.innerWidth; height = window.innerHeight; + scroll = + domUtils.ownerDocument(containerNode).documentElement.scrollTop || + containerNode.scrollTop; } else { width = containerNode.offsetWidth; height = containerNode.offsetHeight; + scroll = containerNode.scrollTop; } - return { - width, height, - scroll: containerNode.scrollTop - }; + return {width, height, scroll}; }, getPosition() {