From 149a718d65c6df6a71acdc0a45e8fe5c6907b933 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Dec 2023 13:38:49 -0800 Subject: [PATCH] Don't scroll List on scroll wheel events outside of its bounds --- crates/gpui2/src/elements/list.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/gpui2/src/elements/list.rs b/crates/gpui2/src/elements/list.rs index 415a3b7368..73bd319afc 100644 --- a/crates/gpui2/src/elements/list.rs +++ b/crates/gpui2/src/elements/list.rs @@ -458,7 +458,10 @@ impl Element for List { let list_state = self.state.clone(); let height = bounds.size.height; cx.on_mouse_event(move |event: &ScrollWheelEvent, phase, cx| { - if phase == DispatchPhase::Bubble { + if phase == DispatchPhase::Bubble + && bounds.contains(&event.position) + && cx.was_top_layer(&event.position, cx.stacking_order()) + { list_state.0.borrow_mut().scroll( &scroll_top, height,