-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pickers][DateTimePicker] Clicking outside of the popup fires onAccept
#15646
Comments
onAccept
I cannot find anything in the aria requirements for the dialog closing "on click away"-behavior. It makes sense though that when a new value is selected it will fire it. Otherwise you would need to reset the previous value in the field, which is arguably worse. @LukasTy or @flaviendelangle do you remember the reasoning behind the implementation? |
Most of the current lifecycle comes from #4408 The optimal behavior is quite subjective and can vary depending on the picker (does it has several view that are rendered one after another? does it have several views rendered side by side? or does it have a single view). We settled for always comitting when dimissing the picker. |
Just from the business side. There is a relatively important date picker. A person clicks on it, and the person forgets the old value, so the person intends to close the window without saving. But what I'm saying there is a use case for it. |
There are a few options we could take. One being implementing a flag that resets the value when clicked outside instead of accepting it. But as mentioned by @flaviendelangle we have nothing planned as of now. I'll add a |
Steps to reproduce
If I click outside of the DateTimePicker popup
onAccept is fired
I want onAccept to be fired only if I press OK. As far as I understand, this should be an expected behavior.
If I add a cancel button, though, and if I click cancel, then onAccept is not fired, which is good.
Current behavior
If I click outside of the date popup onAccept is fired. Closing window is not a confirmation...
Expected behavior
I want onAccept to be fired only if I press OK. As far as I understand, this should be an expected behavior.
Or at least this must be achievable.
Context
No response
Your environment
| Tech | Version |
"@mui/x-date-pickers@^6":
version "6.20.2"
"@mui/[email protected]":
version "5.16.7"
next@^13.1.3:
version "13.1.6"
Search keywords: DateTimePicker onAccept
The text was updated successfully, but these errors were encountered: