Skip to content

Need access to popupContainer element. #94

Open
@adrianhelvik

Description

@adrianhelvik

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions