mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-21 08:01:33 +01:00
ce6c5413f1
Follow up of https://github.com/zed-industries/zed/pull/66482 Wide submenus could open on top of their own menu, and popovers near the window bottom got pushed up over their button. The side was picked while rendering, before the menu's real size was known, so submenus guessed 200px wide and popovers never switched sides at all. This adds `Anchored::attach(target, corner)` to GPUI, which picks the side during layout using the real size and moves the element to the other side of the target when it doesn't fit. Submenus and `PopoverMenu` use it. `DropdownMenu` now opens left-aligned under its button, and settings row dropdowns opt into right alignment. Left out on purpose: - Pickers can switch between above and below as the list shrinks while you type. Using the side that fits seems better than a stale one. Before: <img width="300" src="https://github.com/user-attachments/assets/9a45aba2-6149-4835-8aa5-c2e8ae49c9b2" /> After: <img width="300" src="https://github.com/user-attachments/assets/148e205d-dd6b-4c59-9ed4-5ad37054725e" /> <img width="300" src="https://github.com/user-attachments/assets/88a24ac6-e1c5-4e92-b9be-26f813b1b576" /> Release Notes: - Fixed wide submenus and popovers covering the menu or button they open from. - [GPUI] Added `Anchored::attach` to place an element next to a target and flip it to the other side when it doesn't fit.