From ac15f145b19910ce2b004d8ab69097e3db14b7f8 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 14 Mar 2024 14:42:24 +0000 Subject: [PATCH 1/2] Let mouse scroll events pass through disabled widgets Fixes #4242 --- src/textual/widget.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index 4550ec3fe1..a0409fa262 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -3567,8 +3567,12 @@ def check_message_enabled(self, message: Message) -> bool: message_type = type(message) if self._is_prevented(message_type): return False - # Otherwise, if this is a mouse event, the widget receiving the - # event must not be disabled at this moment. + # Mouse scroll events should always go through, this allows mouse + # wheel scrolling to pass through disabled widgets. + if isinstance(message, (events.MouseScrollDown, events.MouseScrollUp)): + return True + # Otherwise, if this is any other mouse event, the widget receiving + # the event must not be disabled at this moment. return ( not self._self_or_ancestors_disabled if isinstance(message, (events.MouseEvent, events.Enter, events.Leave)) From 17405ee64810bfdeeefa835885b6bd0230cbdeba Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 14 Mar 2024 15:10:04 +0000 Subject: [PATCH 2/2] Update the ChangeLog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 497ae2bc23..9f1ea7c205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed a style leak from `TabbedContent` https://github.com/Textualize/textual/issues/4232 - Fixed active hidden scrollbars not releasing the mouse https://github.com/Textualize/textual/issues/4274 - Fixed the mouse not being released when hiding a `TextArea` while mouse selection is happening https://github.com/Textualize/textual/issues/4292 +- Fix mouse scrolling not working when mouse cursor is over a disabled child widget https://github.com/Textualize/textual/issues/4242 ### Changed