Skip to content

Fix: prevent calendar popup from closing on dropdown change - #7409

Merged
lucasmerlin merged 6 commits into
emilk:mainfrom
AStrizh:fix/datepicker-dropdown-does-not-confirm
Sep 4, 2025
Merged

lucasmerlin merged 6 commits into
emilk:mainfrom
AStrizh:fix/datepicker-dropdown-does-not-confirm

Conversation

@AStrizh

@AStrizh AStrizh commented Aug 3, 2025

Copy link
Copy Markdown
Contributor

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.

@lucasmerlin
lucasmerlin self-requested a review August 5, 2025 09:32
@lucasmerlin lucasmerlin added this to the 0.32.1 milestone Aug 5, 2025
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/7409-fixdatepicker-dropdown-does-not-confirm
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk

emilk commented Aug 12, 2025

Copy link
Copy Markdown
Owner

Needs cargo fmt (and a review from @lucasmerlin) :)

@lucasmerlin lucasmerlin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calendar still closes when user clicks off of it, as before.

This is not true, you now have to click ok or cancel to close it. Which is still better than the current behavior, but Ideally we should have some way to properly support popup-in-popup (maybe via #7451)

Comment thread crates/egui_extras/src/datepicker/button.rs Outdated
Comment thread crates/egui_extras/src/datepicker/button.rs Outdated
Comment thread crates/egui_extras/src/datepicker/button.rs Outdated
@lucasmerlin

Copy link
Copy Markdown
Collaborator

I'll take this over so we can get it into 0.32.2

@lucasmerlin lucasmerlin self-assigned this Sep 4, 2025
@lucasmerlin lucasmerlin added bug Something is broken egui labels Sep 4, 2025
@lucasmerlin
lucasmerlin requested a review from emilk September 4, 2025 10:53
@lucasmerlin
lucasmerlin merged commit 763e2df into emilk:main Sep 4, 2025
26 checks passed
lucasmerlin added a commit that referenced this pull request Sep 4, 2025
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 <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
lucasmerlin added a commit that referenced this pull request Sep 4, 2025
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 <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
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 <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants