fix(popover): forward in-flight pointer events to modal popups so a selection drag started inside still receives its release

This commit is contained in:
Frederic Laing 2026-06-26 16:11:25 +02:00 committed by Michael Murphy
parent 13fb598517
commit e7f37f3e81

View file

@ -402,6 +402,26 @@ where
&& matches!(event, Event::Mouse(_) | Event::Touch(_))
&& !cursor_position.is_over(layout.bounds())
{
// Swallow new presses outside the popup, but still forward other
// events so an interaction started inside it (such as a selection
// drag) receives its release once the cursor leaves the bounds.
let is_press = matches!(
event,
Event::Mouse(mouse::Event::ButtonPressed(_))
| Event::Touch(touch::Event::FingerPressed { .. })
);
if !is_press {
self.content.as_widget_mut().update(
self.tree,
event,
layout,
cursor_position,
renderer,
clipboard,
shell,
&layout.bounds(),
);
}
shell.capture_event();
return;
}