-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug where a position: fixed popover content doesn't scroll (#1064)
* Fix bug where a position: fixed popover content doesn't scroll * changelog * Add a repositionOnScroll prop to EuiPopover * correct the changelog * addressing PR feedback * update changelog diff
- Loading branch information
1 parent
30013e9
commit b98ab5b
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
|
||
import { | ||
EuiButton, | ||
EuiPopover, | ||
} from '../../../../src/components'; | ||
|
||
export default class PopoverContainer extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isExampleShown: false, | ||
isPopoverOpen: false, | ||
}; | ||
} | ||
|
||
toggleExample = () => this.setState(({ isExampleShown }) => ({ isExampleShown: !isExampleShown })) | ||
|
||
onButtonClick = () => { | ||
this.setState({ | ||
isPopoverOpen: !this.state.isPopoverOpen, | ||
}); | ||
} | ||
|
||
closePopover = () => { | ||
this.setState({ | ||
isPopoverOpen: false, | ||
}); | ||
} | ||
|
||
setPanelRef = node => this.panel = node; | ||
|
||
render() { | ||
const button = ( | ||
<EuiButton | ||
iconType="arrowDown" | ||
iconSide="right" | ||
onClick={this.onButtonClick} | ||
style={{ background: 'white' }} | ||
> | ||
Show fixed popover | ||
</EuiButton> | ||
); | ||
|
||
return ( | ||
<React.Fragment> | ||
<EuiButton onClick={this.toggleExample}>Toggle Example</EuiButton> | ||
{this.state.isExampleShown && ( | ||
<EuiPopover | ||
button={button} | ||
isOpen={this.state.isPopoverOpen} | ||
closePopover={this.closePopover} | ||
style={{ position: 'fixed', bottom: 50, right: 50 }} | ||
repositionOnScroll={true} | ||
> | ||
<div> | ||
This popover scrolls with the button element! | ||
</div> | ||
</EuiPopover> | ||
)} | ||
</React.Fragment> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters