Skip to content

Commit

Permalink
Fixed #868 - Flipped OverlayPanel rendered behind browser
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 26, 2019
1 parent b8fc64d commit aee2827
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/utils/DomHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit aee2827

Please sign in to comment.