ant-design/ant-design
在 GitHub 查看Visual glitch when opening a Modal containing an already opened Select
Open
#48,497 建立於 2024年4月16日
Inactivehelp wantedunconfirmed🧶 Low Priority
描述
Reproduction link
Steps to reproduce
Click the "Open modal" button in the reproduction sandbox.
What is expected?
The opened select should show up in perfect sync with the modal.
What is actually happening?
Both components open at slightly different places, then are overlapping correctly.
| Environment | Info |
|---|---|
| antd | 5.1.6 |
| React | 18.2.0 |
| System | Windows 10 Pro |
| Browser | Firefox 124.0.2 |
A fix that works is to use the getPopupContainer attribute of Select, to specify that the modal content should be the container of the select. Concretely having the getPopupContainer callback returning this: document.getElementsByClassName("ant-modal-content")[0].
But we'd rather avoid doing that and have the perfect synchronization working out the box.
Note: the glitch doesn't look that bad on the sandbox, but does look pretty bad in our application.