react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Clearable Causes onBlur

Open salkiducky opened this issue 9 years ago • 3 comments

In my code, I am using react-datepicker as the date part of a date/time field. We wish to implement onFocus/onBlur-onBlurChange functionality.

This is the sequence expected within our setup along with what should be triggering at which point:

  1. Click Datepicker, select a date. Field Gains Focus
  2. Hit Tab. Enter a Hour.
  3. Hit Tab. Enter a Minute.
  4. Hit Tab. Select AM/PM.
  5. Hit Tab. Field Loses Focus and Change

Alternatively, if no values were entered or selected and you just tabbed through, field would Lose Focus at step 5.

However, Clearable is causing problems with that sequence. What happens instead is;

  1. Click Datepicker, select a date. Field Gains Focus
  2. Hit Tab. Field Loses Focus on Change (This is where Clearable seems to be)
  3. Hit Tab. Enter a Hour.
  4. Hit Tab. Enter a Minute.
  5. Hit Tab. Select AM/PM.
  6. Hit Tab to exit field. image

I have attempted to remove Clearable(seen below) and it will tab through appropriately. image

Thank you in advance, I feel this might be a desired fix beyond just our means.

salkiducky avatar Aug 08 '17 15:08 salkiducky

As a workaround to get the exact semantics that you want, I suggest implementing clearable externally from this component, i.e. a button that clears the selected date in your state.

rafeememon avatar Aug 08 '17 15:08 rafeememon

Yes, thank you for the suggestion, but we're looking to keep the interface of our field somewhat clean and not cluttered with extra buttons, so it would be the most ideal case that the 'clearable' button would work for us if changed.

I understand this may be a long shot, but we wanted to give it a shot.

salkiducky avatar Aug 10 '17 14:08 salkiducky

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 30 '19 20:08 stale[bot]