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

Bug: datepicker doesn't close after switching months without picking a date

Open kfrn-nec opened this issue 6 years ago • 2 comments

Thanks for your work on this very useful library!
Today however, I have a bug to enquire about:

When one ....

  1. clicks on the datepicker <input> to open the datepicker proper (i.e., the calendar selector), and
  2. uses the arrows to switch to a different month, or click the header area, but
  3. doesn't select a date ... the datepicker doesn't collapse/minimise when you click on a point outside it. It will only collapse if a date is picked.

If you don't change the month, the datepicker will collapse when you click outside it.

This happens because once you click outside the input, it (the input) is blurred. This is fine if you're simultaneously selecting a date, or changing the month, but it doesn't work so well if you click outside the datepicker.

Is this a known bug? I checked the issues, but couldn't see anything about this.

kfrn-nec avatar Feb 08 '18 06:02 kfrn-nec

This is not a known bug but I can see what's happening. Thanks for the report! For anyone who's interested, the problem is that the picker only processes blur events on the input, not the attached picker div. Picking a day closes the picker, but if you click anything else in the picker (even the name of the month, as well as the month arrows), you can strand it open.

bbqbaron avatar Feb 11 '18 22:02 bbqbaron

Thanks @bbqbaron, for explaining more clearly than I did!

Since divs aren't focusable/blurrable, I couldn't see an easy fix to this, but I'll keep thinking.

kfrn-nec avatar Feb 12 '18 00:02 kfrn-nec