1

I have something like this:

<Portal>
  <BigComponent>
     <Select options={[...]} />
  </BigComponent> 
</Portal>

The select options are created in a div next to the BigComponent one. The BigComponent div is absolutely positioned with a high z-index.

This makes it so that it covers the options of the dropdown. I can fix it in dev tools by giving position relative to the div that Antd creates and giving it a high z-index, but the problem is it has no selector so no way of targeting it.

Any fix?

2 Answers 2

1

Found it! There's a prop getPopupContainer that takes a function which returns a selector, I just selected my BigComponent div and it works fine now :)

Sign up to request clarification or add additional context in comments.

Comments

1

<Select options={[{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]} getPopupContainer={() => document.getElementById('big-component') || document.body} // Fallback to document.body />

getPopupContainer. is prop in antd select to decide the component over which we have to show the popUpContainer

like here we use 'big-component'

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.