From fea465e7143fc0f36ead45b204effcd27518a9b2 Mon Sep 17 00:00:00 2001 From: Gorkem CINAR Date: Wed, 19 Jul 2017 14:14:55 +0100 Subject: [PATCH] #4783 - As discussed on https://github.com/callemall/material-ui/issues/4393 and https://github.com/callemall/material-ui/issues/4783 I have provided a fix for popover position issue on autocomplete. --- src/Popover/Popover.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Popover/Popover.js b/src/Popover/Popover.js index a82fe3f15015b8..99eb1054b8c74d 100644 --- a/src/Popover/Popover.js +++ b/src/Popover/Popover.js @@ -89,6 +89,11 @@ class Popover extends Component { * The zDepth of the popover. */ zDepth: propTypes.zDepth, + + scrollElement : PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string, + ]), }; static defaultProps = { @@ -304,8 +309,8 @@ class Popover extends Component { targetPosition = this.applyAutoPositionIfNeeded(anchor, target, targetOrigin, anchorOrigin, targetPosition); } - targetEl.style.top = `${Math.max(0, targetPosition.top)}px`; - targetEl.style.left = `${Math.max(0, targetPosition.left)}px`; + targetEl.style.top = `${targetPosition.top}px`; + targetEl.style.left = `${targetPosition.left}px`; targetEl.style.maxHeight = `${window.innerHeight}px`; }; @@ -395,7 +400,7 @@ class Popover extends Component { return (