-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Popover] Scroll Container issue #7472
Changes from 2 commits
fea465e
14c5824
629307e
d0a9a75
553024b
1b9e3a7
75799de
9dbdb43
50b7c83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,13 @@ class Popover extends Component { | |
* The zDepth of the popover. | ||
*/ | ||
zDepth: propTypes.zDepth, | ||
/** | ||
* TODO | ||
*/ | ||
scrollElement: PropTypes.oneOfType([ | ||
PropTypes.object, | ||
PropTypes.string, | ||
]), | ||
}; | ||
|
||
static defaultProps = { | ||
|
@@ -304,8 +311,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`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change appears to be breaking large lists where the scrolling container (e.g. window) doesn't actually scroll. Previously prior to this change, having the 'Math.max' bit allowed the popover content to scroll rather than the scrolling container, but by allowing the popover to now extend beyond the bounds of the target element, this is broken. Could we perhaps have a new prop to bring back clamping to 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have created issue #7573 for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamespizzurro Oh, we can always revert. I think that we will soon freeze the master branch. Fixes have been introducing too many regressions lately, the master doesn't have enough tests. |
||
targetEl.style.maxHeight = `${window.innerHeight}px`; | ||
}; | ||
|
||
|
@@ -395,7 +402,7 @@ class Popover extends Component { | |
return ( | ||
<div style={styles.root}> | ||
<EventListener | ||
target="window" | ||
target={this.props.scrollElement || "window"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about using a defaultProps instead? |
||
onScroll={this.handleScroll} | ||
onResize={this.handleResize} | ||
/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a description for the documentation?