diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 8faf8e77ceb..9eff009c921 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -698,7 +698,7 @@ impl MenuState { // We don't close the submenu if the pointer is on its way to hover it. // ensure to repaint once even when pointer is not moving ui.ctx().request_repaint(); - } else if !open && button.hovered() { + } else if !open && (button.hovered() || button.clicked()) { // TODO(emilk): open menu to the left if there isn't enough space to the right let mut pos = button.rect.right_top(); pos.x = self.rect.right() + ui.spacing().menu_spacing; @@ -708,6 +708,7 @@ impl MenuState { } else if open && ui.response().contains_pointer() && !button.hovered() + && !button.clicked() && !self.hovering_current_submenu(&pointer) { // We are hovering something else in the menu, so close the submenu.