diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 8faf8e77ceb..064ca828a56 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -698,7 +698,9 @@ 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() || self.hovering_current_submenu(&pointer) || 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;