Only block mouse events if disabled, not if not focusable

This commit is contained in:
Dave Pearson
2023-02-14 10:51:32 +00:00
parent 674ee26b88
commit d27d9f81af

View File

@@ -2449,9 +2449,13 @@ class Widget(DOMNode):
# Do the normal checking and get out if that fails.
if not super().check_message_enabled(message):
return False
# Otherwise, if this is a mouse event the widget receiving the event
# must be capable of being focused right at this moment.
return self.focusable if isinstance(message, events.MouseEvent) else True
# Otherwise, if this is a 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)
else True
)
async def broker_event(self, event_name: str, event: events.Event) -> bool:
return await self.app._broker_event(event_name, event, default_namespace=self)