ant-design/ant-design

Visual glitch when opening a Modal containing an already opened Select

Open

#48,497 建立於 2024年4月16日

在 GitHub 查看
 (1 留言) (3 反應) (0 負責人)TypeScript (98,031 star) (54,612 fork)batch import
Inactivehelp wantedunconfirmed🧶 Low Priority

描述

Reproduction link

Edit on CodeSandbox

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.

貢獻者指南