Skip to content

Commit 63838d1

Browse files
committed
docs
1 parent cecfe3e commit 63838d1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/guide/input.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ Textual will send a [MouseCapture](../events/mouse_capture.md) event when the mo
232232

233233
Textual will send a [Enter](../events/enter.md) event to a widget when the mouse cursor first moves over it, and a [Leave](../events/leave.md) event when the cursor moves off a widget.
234234

235+
Both `Enter` and `Leave` _bubble_, so a widget may receive these events from a child widget.
236+
You can check the initial widget these events were send to by comparing the `node` attribute against `self` in the message handler.
237+
235238
### Click events
236239

237240
There are three events associated with clicking a button on your mouse. When the button is initially pressed, Textual sends a [MouseDown](../events/mouse_down.md) event, followed by [MouseUp](../events/mouse_up.md) when the button is released. Textual then sends a final [Click](../events/click.md) event.

src/textual/widget.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,13 @@ def is_anchored(self) -> bool:
544544

545545
@property
546546
def is_mouse_over(self) -> bool:
547-
"""Is the mouse currently over this widget?"""
547+
"""Is the mouse currently over this widget?
548+
549+
Note this will be `True` if the mouse pointer is within the widget's region, even if
550+
the mouse pointer is not directly over the widget (there could be another widget between
551+
the mouse pointer and self).
552+
553+
"""
548554
if not self.screen.is_active:
549555
return False
550556
for widget, _ in self.screen.get_widgets_at(*self.app.mouse_position):

0 commit comments

Comments
 (0)