Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Help › Search: clicking the search field keeps the menu open (#1027)

jason4shorte63ff5196bf7
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index e73520c23..95b7726ff 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -834,7 +834,15 @@ pub fn menu_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> f32 {
// The release ending the press that opened this menu is a click "outside" the
// popup: it must not close it again.
let opening = title.clicked() && ui.ctx().data(|d| d.get_temp::<bool>(press_gesture_id())).unwrap_or(false);
- let close = if opening { egui::PopupCloseBehavior::IgnoreClicks } else { config.close_behavior };
+ let close = if opening {
+ egui::PopupCloseBehavior::IgnoreClicks
+ } else if top == "Help" {
+ // Menus close on any click, inside them too; a click in Help's search field
+ // must keep it open. Its items close it themselves when chosen.
+ egui::PopupCloseBehavior::CloseOnClickOutside
+ } else {
+ config.close_behavior
+ };
egui::Popup::menu(&title)
.open_memory(open)
.close_behavior(close)