[Dropdown] : Dropdown menu renders already scrolled when max-height is applied
Reproduction link
Steps to reproduce
Position the dropdown at top of viewport. Open it. Dropdown menu will render, is scrollable and is not automatically scrolled.
Then close it. Then position the dropdown at the bottom of viewport. Then open the dropdown. The menu will open already scrolled close to the bottom.
What is expected?
I expect the dropdown to always open with the menu not already scrolled.
What is actually happening?
The menu is opening already scrolled depending on where the dropdown is relative to the viewport. This specifically occurs when autoFocus = {true} and autoAdjustOverflow={false}.
| Environment | Info |
|---|---|
| antd | 6.1.0 |
| React | 19.2.1 |
| System | Windows 10 |
| Browser | Chrome: Version 143.0.7499.41 (Official Build) (64-bit) |
While not particularly egregious for standard dropdowns, it can create a really bad UX for keyboard users who open a submenu using the arrow key. (shown in video)
https://github.com/user-attachments/assets/9b997a6a-be6b-4ba6-a2fa-1bc24a926122
Source: ant-design/ant-design