Skip to content

Commit

Permalink
Don't scroll List on scroll wheel events outside of its bounds (#3685)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld authored Dec 15, 2023
2 parents ee77728 + 149a718 commit c8e9186
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/gpui2/src/elements/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c8e9186

Please sign in to comment.