From aee2827af3eb3b75297632d8a3d4d4c9218c3b2a Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 26 Apr 2019 14:46:19 +0300 Subject: [PATCH] Fixed #868 - Flipped OverlayPanel rendered behind browser --- src/components/utils/DomHandler.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/utils/DomHandler.js b/src/components/utils/DomHandler.js index 354eef3917..3f499cd245 100644 --- a/src/components/utils/DomHandler.js +++ b/src/components/utils/DomHandler.js @@ -187,13 +187,18 @@ export default class DomHandler { let viewport = this.getViewport(); let top, left; - if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) + if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) { top = targetOffset.top + windowScrollTop - elementOuterHeight; - else + if(top < 0) { + top = 0 + windowScrollTop; + } + } + else { top = targetOuterHeight + targetOffset.top + windowScrollTop; + } if (targetOffset.left + targetOuterWidth + elementOuterWidth > viewport.width) - left = targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth; + left = Math.max(0, targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth); else left = targetOffset.left + windowScrollLeft;