fix: Picker shouldn't autoselect values on picking dates in different picker panel mode that the original picker mode #788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when we have date picker with type =
date
and switch the panel mode selection through the popup tomonth
and thenyear
and then select anyear
from that picker to narrow down the date selection,triggerCalendarChange
function is called, even though the picker mode isdate
, which causes the date associated with the year(01-01-year) to be auto-selected and shown in the input. There is also a comment ontriggerCalendarChange
, which says// Only trigger calendar event but not update internal
calendarValuestate
, but triggerCalendarChange does update thecalendarValue
internally in useInnerValue hook line 147 -setCalendarValue(clone);
.A fix to the issue would be to not trigger the calendar change until the panel and picker modes are the same.
Using the
multiple
storybook where we have date picker and navigating to decade panel and selecting 2000-2009, causes value 2000-04-08 to be auto-selected as first multiples value