-
-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
When selecting the same date from a BasicDatePicker
twice in a row (a duplicate selection), the component resets its entire state, and clears out the selection.
From looking at the code, it seems like this behavior is supposed to happen. However, it seems counter-intuitive to me to clear the whole selection if a date is selected twice.
I can't come up with an easy workaround for this in my own code.
If I were to create a PR related to this, I could do one of two things:
- Stop the state from resetting on a duplicate selection, and instead close or keep open the date picker according to the
keepOpenOnSelect
prop. - Add a new boolean prop (
clearOnDuplicate
or something to that effect), defaulting totrue
(the current behavior), which controls whether or not this behavior occurs in the first place. I.e:clearOnDuplicate={false}
: If a duplicate selection is made, nothing happens, and the date picker closes or remains open according to the value ofkeepOpenOnSelect
.clearOnDuplicate={true}
: If a duplicate selection is made, the component's state is completely reset (current behavior, possible default).
Let me know what y'all think.
Metadata
Metadata
Assignees
Labels
No labels