Skip to content

Commit

Permalink
Ensure hover effect doesnt linger when mouse leaves Tree (#4766)
Browse files Browse the repository at this point in the history
* Ensure hover effect doesnt linger when mouse leaves Tree

* Update CHANGELOG
  • Loading branch information
darrenburns authored Jul 17, 2024
1 parent 8a16ddf commit 4414ecc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `TreeNodeSelected` messages are now posted before `TreeNodeExpanded` messages
when an expandable node is selected https://github.com/Textualize/textual/pull/4753
- `Markdown.LinkClicked.href` is now automatically unquoted https://github.com/Textualize/textual/pull/4749
- The mouse cursor hover effect of `Tree` and `DirectoryTree` will no longer linger after the mouse leaves the widget https://github.com/Textualize/textual/pull/4766


## [0.72.0] - 2024-07-09
Expand Down
4 changes: 4 additions & 0 deletions src/textual/widgets/_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,10 @@ def _on_mouse_move(self, event: events.MouseMove) -> None:
else:
self.hover_line = -1

def _on_leave(self, _: events.Leave) -> None:
# Ensure the hover effect doesn't linger after the mouse leaves.
self.hover_line = -1

def _new_id(self) -> NodeID:
"""Create a new node ID.
Expand Down

0 comments on commit 4414ecc

Please sign in to comment.