ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
91.6k stars 48.31k forks source link

Popover and Select #3438

Closed plandem closed 7 years ago

plandem commented 7 years ago

Is it possible to prevent the changing of visibility of popover after interaction with Select?

Here is demo: http://codepen.io/anon/pen/XjBVbp?editors=0011

afc163 commented 7 years ago

getPopupContainer https://ant.design/components/select/#Select-props

https://codepen.io/anon/pen/NaMbVg?editors=0011

You can use getPopupContainer={triggerNode => triggerNode.parentNode} to make select dropdown menu rendering inside the Popover content.

https://github.com/ant-design/ant-design/wiki/FAQ#select-dropdown-datepicker-timepicker-popover-popconfirm-will-scroll-with-page

3487

plandem commented 7 years ago

Works! i would add this to official examples. Thanks.

guohuihuiguo commented 5 years ago

hello 我试着用上面的方法 getPopupContainer={(triggerNode: any) => triggerNode.parentNode} 结果

1556620903631-image 遮盖了select<Select getPopupContainer={(triggerNode: any) => triggerNode.parentNode} mode="multiple" notFoundContent={selectLoading ? <Spin size="small" /> : ``} filterOption={false} onSearch={this.totalFocusHandler.bind(this,siteCode`)} style={{ width: '100%' }}

{siteCodeList.map((item: any, index: any) => <Option key={${item.sitecode}${index}} value={item.sitecode} >{item.sitecode})} `

mix0000 commented 2 years ago

getPopupContainer https://ant.design/components/select/#Select-props

https://codepen.io/anon/pen/NaMbVg?editors=0011

You can use getPopupContainer={triggerNode => triggerNode.parentNode} to make select dropdown menu rendering inside the Popover content.

https://github.com/ant-design/ant-design/wiki/FAQ#select-dropdown-datepicker-timepicker-popover-popconfirm-will-scroll-with-page

3487

Thats not work for Ant Date Pickers.

krmao commented 2 years ago

try to set position: relative; to the parent \<div \/> @mix0000

mix0000 commented 2 years ago

try to set position: relative; to the parent

@mix0000

Okey I fix it!

Antd uses rc-picker which uses dom-align and they have options for positioning your element.

<DatePicker
  ....
  dropdownAlign={{
    points: ["tr", "br"]
  }}
  ....
/>
lwh795 commented 2 years ago

Use getpopupcontainer = {triggernode = > triggernode. Parentnode} in the select in the modal. When the focus is obtained in IE 11,the whole modal will flash.

lwh795 commented 2 years ago

使用 getpopupcontainer = {triggernode = > triggernode. Parentnode} 在模态中的选择中。在 IE 11 中获得焦点时,整个 modal 会闪烁。

For the same problem as this bug(https://github.com/ant-design/ant-design/issues/21039), I found a temporary solution from the comments

chandpratik commented 2 years ago

getPopupContainer https://ant.design/components/select/#Select-props https://codepen.io/anon/pen/NaMbVg?editors=0011 You can use getPopupContainer={triggerNode => triggerNode.parentNode} to make select dropdown menu rendering inside the Popover content. https://github.com/ant-design/ant-design/wiki/FAQ#select-dropdown-datepicker-timepicker-popover-popconfirm-will-scroll-with-page

3487

Thats not work for Ant Date Pickers.

Try using getCalendarContainer={trigger => trigger.parentElement}