mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 07:30:22 +01:00
a72cb6a214
Closes #56224 Follow-up to #66167. With `focus_follows_mouse` on, right-click menus and popup pickers close as soon as you move the mouse onto another pane. Focus jumps to that pane, and menus close when they lose focus. #66167 fixed this for inputs like the rename field, but not for menus. It spotted inputs by their key context, and some menus use their own custom key context, so there was no reliable way to spot them the same way. So this takes a different approach. Menus, pickers and single-line inputs now add their focus handle to a small list in `ui` when they're created. Focus follows mouse checks that list and doesn't move focus while one of them is focused. This works like `ReopenablePickerRegistry` in `modal_layer.rs`. Approaches considered: - Keep checking key contexts: menus with a custom key context would still close. - Add a flag to gpui's `FocusHandle`: works too, but gpui itself would never use it. Focus follows mouse is a Zed feature, so gpui shouldn't need to know about it. Release Notes: - Fixed right-click menus and popup pickers closing when the mouse moves to another pane with `focus_follows_mouse` enabled.