diff --git a/ports/servoshell/desktop/headed_window.rs b/ports/servoshell/desktop/headed_window.rs index 39021171945..8e9cc88ec42 100644 --- a/ports/servoshell/desktop/headed_window.rs +++ b/ports/servoshell/desktop/headed_window.rs @@ -287,6 +287,10 @@ impl Window { }; let point = self.webview_relative_mouse_point.get(); + // `point` can be outside viewport, such as at toolbar with negative y-coordinate. + if !webview.rect().contains(point) { + return; + } let action = match action { ElementState::Pressed => MouseButtonAction::Down, ElementState::Released => MouseButtonAction::Up,