Stop propagation on workspace popover dismiss click
The backdrop closed the picker on mouse_down but didn't consume the event. The same press would propagate to the top div and the same click sequence's mouse_up could then land on whatever element ended up under the cursor (a tab, a button) once the backdrop unmounted on the next render — dismissing the popover would inadvertently fire a second action. Add `cx.stop_propagation()` after the close so the dismiss click ends at the backdrop. Standard popover semantics: outside-click closes, consumed.
This commit is contained in:
@@ -210,8 +210,9 @@ pub(crate) fn render_workspace_disclosure(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Transparent fullscreen backdrop layered between the layout grid
|
/// Transparent fullscreen backdrop layered between the layout grid
|
||||||
/// and the disclosure. Any click on it closes the picker; the
|
/// and the disclosure. Press on it closes the picker AND consumes
|
||||||
/// disclosure paints after this backdrop so it remains interactive.
|
/// the event so the dismiss-click doesn't ricochet into a button
|
||||||
|
/// underneath the cursor.
|
||||||
pub(crate) fn render_workspace_disclosure_backdrop(
|
pub(crate) fn render_workspace_disclosure_backdrop(
|
||||||
cx: &mut Context<ElyShell>,
|
cx: &mut Context<ElyShell>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
@@ -223,6 +224,7 @@ pub(crate) fn render_workspace_disclosure_backdrop(
|
|||||||
gpui::MouseButton::Left,
|
gpui::MouseButton::Left,
|
||||||
cx.listener(|shell, _: &gpui::MouseDownEvent, _, cx| {
|
cx.listener(|shell, _: &gpui::MouseDownEvent, _, cx| {
|
||||||
shell.close_workspace_picker(cx);
|
shell.close_workspace_picker(cx);
|
||||||
|
cx.stop_propagation();
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
|
|||||||
Reference in New Issue
Block a user