Skip to content
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

Need access to popupContainer element. #94

Open
adrianhelvik opened this issue Jun 14, 2018 · 1 comment
Open

Need access to popupContainer element. #94

adrianhelvik opened this issue Jun 14, 2018 · 1 comment

Comments

@adrianhelvik
Copy link

I am using rc-slider and I need to set the z-index for the element created by getContainer.
I also propose putting this logic inside componentDidMount() and clean up in componentWillUnmount.

Alternatively you could set the styling for the element within the portal. Right now it's a bit tricky to work with.

getContainer = () => {
  const { props } = this;
  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 = '0';
  popupContainer.style.left = '0';
  popupContainer.style.width = '100%';
  const mountNode = props.getPopupContainer ?
    props.getPopupContainer(findDOMNode(this)) : props.getDocument().body;
  mountNode.appendChild(popupContainer);
  return popupContainer;
}
@adrianhelvik adrianhelvik changed the title Need access to container element. Need access to popupContainer element. Jun 14, 2018
@adrianhelvik
Copy link
Author

Temporary solution:

getDocument={() => {
  return {
    body: {
      appendChild(child) {
        child.style.zIndex = 5
        document.body.appendChild(child)
      }
    }
  }
}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant