From eac8285bf7024c57c690c352394ef27c8be97903 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Wed, 18 Nov 2026 14:49:41 +0000 Subject: [PATCH] menu companion layer takes no key scope, so Escape reaches the menu after the bar's list closes --- crates/ui-widgets/src/menu/popup.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-widgets/src/menu/popup.rs b/crates/ui-widgets/src/menu/popup.rs index 50179da00..6c806cab5 100644 --- a/crates/ui-widgets/src/menu/popup.rs +++ b/crates/ui-widgets/src/menu/popup.rs @@ -414,8 +414,9 @@ impl Container for Menu<'_> { /// The companion bar, shown as a child layer of the menu's: it is in the menu's press family and closes with the /// menu. - fn end(&mut self, ui: &mut Ui, _: &mut BodyCx<'_>) { + fn end(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>) { let Some(bar) = self.companion.as_mut() else { return }; + eprintln!("DIAG a_press_on_the_companion_bar_or_its_popup_does_not_close_the_menu_and_the_bar_closes_with_the_menu: companion end, open={}", cx.is_open()); let label = Env::of(ui).words::().bar_companion.clone(); let _ = CompanionLayer::new(label).show(ui, |ui, _| bar(ui)); } @@ -460,7 +461,7 @@ impl CompanionLayer { let overlay = Overlay::floating() .modeless() .body_scroll(false) - .focus(FocusPolicy::TAB_LAYER) + .focus(FocusPolicy::NONE) .dismiss(Dismiss::new().outside(Outside::Keep)) .place(Place::anchored(Anchor::Parent, Side::Above, Align::Center)); let props = ContainerProps::new().mount(Mount::Layer(overlay)).surface(SurfaceKind::Floating).pad(Pad::None).sizing(Sizing::Content);