Skip to content

Commit 4414ecc

Browse files
authored
Ensure hover effect doesnt linger when mouse leaves Tree (#4766)
* Ensure hover effect doesnt linger when mouse leaves Tree * Update CHANGELOG
1 parent 8a16ddf commit 4414ecc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3535
- `TreeNodeSelected` messages are now posted before `TreeNodeExpanded` messages
3636
when an expandable node is selected https://github.com/Textualize/textual/pull/4753
3737
- `Markdown.LinkClicked.href` is now automatically unquoted https://github.com/Textualize/textual/pull/4749
38+
- 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
3839

3940

4041
## [0.72.0] - 2024-07-09

src/textual/widgets/_tree.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,10 @@ def _on_mouse_move(self, event: events.MouseMove) -> None:
839839
else:
840840
self.hover_line = -1
841841

842+
def _on_leave(self, _: events.Leave) -> None:
843+
# Ensure the hover effect doesn't linger after the mouse leaves.
844+
self.hover_line = -1
845+
842846
def _new_id(self) -> NodeID:
843847
"""Create a new node ID.
844848

0 commit comments

Comments
 (0)