From 11db5e69a57367fed25cfe37da41d657bb3efaf0 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 23 Nov 2026 12:24:14 +0100 Subject: [PATCH] Red round 3: keep keyboard focus unless the primary button clicked a host target --- crates/ui-egui/src/panels/detail/host.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/detail/host.rs b/crates/ui-egui/src/panels/detail/host.rs index 69c6f89273..ee77a13792 100644 --- a/crates/ui-egui/src/panels/detail/host.rs +++ b/crates/ui-egui/src/panels/detail/host.rs @@ -151,8 +151,8 @@ pub(crate) fn target(ui: &mut Ui, key: impl Hash + std::fmt::Debug, rect: Rect, let out = control.show_at(ui, rect); // A pointer click acts and leaves no keyboard focus behind, as the raw click targets these replace did: a focused // control makes the shell treat the next Escape as a text field's, so Escape would not go back from the photo. - // A key activation keeps its focus. - if out.clicked() && !out.by_key { + // Only a primary-button click does: a right-click opens its menu from this target. A key activation keeps its focus. + if out.clicked() && !out.by_key && ui.input(|input| input.pointer.button_released(egui::PointerButton::Primary)) { ui.ctx().memory_mut(|memory| memory.surrender_focus(out.response.id)); } out