gpui: Add an option to keep hover listeners active after keyboard input (#63614)
While working on https://github.com/zed-industries/zed/pull/63343, I ran
into a problem with the pending key binding indicator. Hovering pauses
its countdown, but pressing the next key made `on_hover` report false
even though the mouse had not moved. The countdown then resumed while
the pointer was still over the indicator.
`on_hover` currently follows GPUI's normal hover rules. GPUI clears
hover after keyboard input so the item under a stationary mouse does not
interfere with keyboard navigation, for example list popover navigation
with keyboard.
This PR adds `HoverListenerMode` and `hover_listener_mode`. Callers that
need to track the pointer across key presses can opt in like this:
```rs
div()
.hover_listener_mode(HoverListenerMode::InputModalityIndependent)
.on_hover(|is_hovered, window, cx| {
// ...
})
```
`InputModalityAware` remains the default.
Release Notes:
- N/A
f0d8b0b0cdSmit Barmase committed on 9/3/2026, 9:35:52 AM· committed by GitHubparentd7b9b38