[RFC] Remove allowSameDateSelection
prop
#4728
Labels
component: pickers
This is the name of the generic UI component, not the React module!
design
This is about UI or UX design, please involve a designer
discussion
dx
Related to developers' experience
RFC
Request For Comments
Current behavior
We have a
allowSameDateSelection
publicly exposed which decided if clicking on the already-selected day should count as a change or not (meaning should it switch to the next view / close the picker).By default, it is
false
except forDateTimePicker
otherwise you can change only the time.But on #4456 we see that we have the exact same problem on
DatePicker
Proposal
Remove
allowSameDateSelection
altogetherNow that we merged #4408, we don't call
onChange
when the new value is equal to the old one.The only scenario where this prop has an interest is in
DateRangePicker
if we want to prevent selecting a single day rangeBut as Sebastian pointed out in mui/material-ui#23701 (comment), this prop is not great for this use case either. I propose to introduce a new prop
isRangeAvailable?: (start: TDate, end: TDate) => boolean
that we could call on both click and hover to visually show that the range the user is aiming for will not pass validation.Relates issues
[DatePicker] Date Picker value cannot be set when changing only the year #4456
[DesktopDatePicker] does not allow user to pick the same date (in diff year) when it is already selected in another year #4613
[DatePicker] Reduce scope of allowSameDateSelection prop #4727
Add ability to select same date in date range picker material-ui-pickers#1759 (comment)
The text was updated successfully, but these errors were encountered: