# gpui: Add an option to keep hover listeners active after keyboard input \(\#63614\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f0d8b0b0cde9a5b5000017c1e60db3ebea274b88)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f0d8b0b0cde9a5b5000017c1e60db3ebea274b88

Requested commit: f0d8b0b0cde9a5b5000017c1e60db3ebea274b88

Commit: f0d8b0b0cde9a5b5000017c1e60db3ebea274b88

Tree: 1437c13c0131e621d6de7d29ccd4e28ed2951af3

Author: Smit Barmase

Committer: GitHub

## Message

````
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
````

## Parents

- [d7b9b38584cdb1e778a781548d32da35b2be1e96](https://git.cafe/gitcafe/zed/commit/d7b9b38584cdb1e778a781548d32da35b2be1e96?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f0d8b0b0cde9a5b5000017c1e60db3ebea274b88?format=markdown)
