Skip to content
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

clearable and autoOk does not work on DateRangePicker #1927

Closed
gReis89 opened this issue Jun 23, 2020 · 5 comments
Closed

clearable and autoOk does not work on DateRangePicker #1927

gReis89 opened this issue Jun 23, 2020 · 5 comments
Labels

Comments

@gReis89
Copy link

gReis89 commented Jun 23, 2020

Environment

Tech Version
@material-ui/pickers 4.0.0-alpha.8
material-ui 4.10.2
React 16.12.0
Browser chrome

Steps to reproduce

Use DateRangePicker with clearable and autoOk={false}

Screen Shot 2020-06-23 at 18 33 37

Expected behavior

The Clear button to be shown in the dialog, and the dialog to keep visible when user has selected both start and end dates

Actual behavior

There are no clear button and the autoOk prop is not keeping the modal open.

Live example

Example

@dmtrKovalenko
Copy link
Member

We doesn't support clearable for desktop mode. And autoOk prop was removed

@oliviertassinari
Copy link
Member

@dmtrKovalenko What do you think about the idea to add support for autoOk or something equivalent so that the change event is only fired once the current selection is validated?

@dmtrKovalenko
Copy link
Member

We do have onAccept prop for that

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 15, 2020

We do have onAccept prop for that

@dmtrKovalenko I had forgotten about this one, I think that it's a different problem. I want to open an RFC to remove onAccept, it started in #1923 (comment).

There are three different cases to consider, that I think don't depend on the nature of the picker, it can be a combobox, a date picker, a time picker, a color picker, etc, it will always be the same:

  1. Is the text field updated ahead of time? Basically, if we take the states of #1980. Is inputValue bound to value or selectedValue? In the Autocomplete, the prop for the behavior is autoComplete: https://material-ui.com/components/autocomplete/#playground
  2. Is the value selected optimistically or not? Does the user need to confirm his choice? This is what the autoOk aims to determine. In the Autocomplete, the prop for the behavior is autoSelect: https://material-ui.com/components/autocomplete/#playground.
  3. Does the popup close when a value is selected? The autoOk prop dictates the behavior. In the Autocomplete, the prop for the behavior is the disableCloseOnSelect prop: https://material-ui.com/components/autocomplete/#playground.

@gReis89
Copy link
Author

gReis89 commented Jul 15, 2020

if the autoOk and clearable aren't supported, is there some component that only exports the Calendars from DateRangePicker so we can implement extra functionalities in the popper as OK and Clear buttons?

I know that the lib exports Calendar and I'm already doing a similar implementation of a DatePicker with it, but I can't see any component in the DOCs that only export the double calendar used by DateRangePicker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants