From 763e2df9f94477f562bb4182776c5319380ea722 Mon Sep 17 00:00:00 2001 From: Aleksandr Strizhevskiy Date: Thu, 4 Sep 2025 07:13:28 -0400 Subject: [PATCH] Fix: prevent calendar popup from closing on dropdown change (#7409) Currently, DatePickerButton will close without saving whenever a user clicks a dropdown from year/month/date. The issue is caused because the system mistakenly interprets the user as clicking off of the calendar. This is unexpected and creates an unpleasant experience for the user. This change now allows the user to use the dropdowns as expected; it will close on save or cancel. The calendar still closes when user clicks off of it, as before. The changes here are made in: crates/egui_extras/src/datepicker/button.rs I will admit that I am not an experienced Rust developer. The changes were made with the help of ChatGPT 4.0. I have tested the changes locally, as I am using the date picker in my project. * Closes * [x] I have followed the instructions in the PR template --------- Co-authored-by: Lucas Meurer --- crates/egui_extras/src/datepicker/button.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/egui_extras/src/datepicker/button.rs b/crates/egui_extras/src/datepicker/button.rs index 0ec0680f..a6e27828 100644 --- a/crates/egui_extras/src/datepicker/button.rs +++ b/crates/egui_extras/src/datepicker/button.rs @@ -192,7 +192,11 @@ impl Widget for DatePickerButton<'_> { button_response.mark_changed(); } + // We don't want to close our popup if any other popup is open, since other popups would + // most likely be the combo boxes in the date picker. + let any_popup_open = ui.ctx().is_popup_open(); if !button_response.clicked() + && !any_popup_open && (ui.input(|i| i.key_pressed(Key::Escape)) || area_response.clicked_elsewhere()) { button_state.picker_visible = false;