Fix first LSP server item flickering and staying highlighted when hovering between multiple language server entries in the status bar menu (#61400)
# Objective - When a submenu is open in a ContextMenu (e.g., an LSP server entry in the status bar menu), focus moves from the main menu to the submenu entity. Hovering over a different submenu trigger calls `on_hover(true)` which runs `window.focus()` to return focus to the main menu. This fires `on_focus_in`, which runs `select_toggled_or_first` → `select_first`, re-selecting the first item. The same issue occurs in `on_hover(false)` when the mouse leaves a trigger with an open submenu. ## Solution - Add a `suppress_focus_selection` flag to `ContextMenu`. Before each `window.focus()` call in `on_hover` handlers, set the flag to `true`. The `on_focus_in` callback checks this flag and skips auto-selection when focus is returning from submenu interaction. The flag is reset to `false` after each `on_focus_in` invocation. ## Testing - Tested manually by opening the LSP status bar menu with multiple running language servers and hovering between server entries. The first item no longer flickers or stays highlighted after hovering over other items. ## Showcase ### before fixed https://github.com/user-attachments/assets/26efb133-fb7e-4dbe-88b7-88d510dfd3a4 ### after fixed https://github.com/user-attachments/assets/7081c07d-d7f6-4a35-abe3-486bfba8591f ## Release Notes: - Fixed a bug where the first LSP server item would flicker and stay highlighted when hovering between multiple language server entries in the status bar menu.
1 file changedLine totals unavailable