Skip to content

Commit

Permalink
Merge pull request #42 from react-component/prevent-scrollbar-appear
Browse files Browse the repository at this point in the history
set default popup container to position absolute
  • Loading branch information
yiminghe committed Feb 24, 2017
2 parents 62e4f19 + 768b5ae commit 6ea92c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Trigger.jsx
Expand Up @@ -62,6 +62,11 @@ const Trigger = React.createClass({

getContainer(instance) {
const popupContainer = document.createElement('div');
// Make sure default popup container will never cause scrollbar appearing
// https://github.com/react-component/trigger/issues/41
popupContainer.style.position = 'absolute';
popupContainer.style.top = '-9999px';
popupContainer.style.left = '-9999px';
const mountNode = instance.props.getPopupContainer ?
instance.props.getPopupContainer(findDOMNode(instance)) : document.body;
mountNode.appendChild(popupContainer);
Expand Down

0 comments on commit 6ea92c7

Please sign in to comment.