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

Menus close on any click, inside them too (egui's CloseOnClick), so a click
in the Help menu's search field closed the menu. The Help menu now closes
only on clicks outside it; its items (and search results) close it
themselves when chosen.

Co-authored-by: Jason Short <3344856+jason4short@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
jason4short 2026-10-08 13:39:10 -07:00 committed by GitHub
parent 649417af1d
commit e63ff5196b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -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)