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

Datepicker won't open again with AutoClose option enabled

Open pedromalta opened this issue 10 years ago • 7 comments

It seems the event to open the calendar picker is some 'onFocus'. So when you use the Auto Close option the calendar closes, but the focus remains on the input thus not opening again when you click on it to edit again. One way to solve it would be to remove focus of the field when you close the calendar through Auto Close.

The issue can be seen on the example: At the "Input with Auto Close" you select one date, then the Calendar hides, you then have to click outside the input and then click on it again if you want to change the date.

Best Regards,

Pedro Malta

pedromalta avatar Oct 15 '15 16:10 pedromalta

Work around doesn't work for me. This is a rather annoying issue. Looking into forking and fixing it myself.

christrude avatar Nov 25 '15 21:11 christrude

In dateTime directive on hidePicker instead of triggering a handler, raising event blur() worked for me. That is changing below lines of code

scope.$on('hidePicker', function () {
                            element.triggerHandler('blur');                            
                        });

to

scope.$on('hidePicker', function () {
                            element.blur();
                        });

Regards,

ab1303 avatar Mar 28 '16 06:03 ab1303

+1 im needing this too

javisperez avatar Apr 11 '16 15:04 javisperez

+1

keithics avatar Apr 15 '16 14:04 keithics

+1 Thanks @ab1303 your fix worked for me

mlemainque avatar May 15 '16 18:05 mlemainque

@ab1303 @mlemainque This gives to me "element.blur is not a function" (I'm not using jQuery)

simonepri avatar Aug 19 '16 08:08 simonepri

This is a working workaround:

scope.$on('hidePicker', function () {
  element.triggerHandler('blur');
  $timeout(function() {
    element[0].blur();
  }, 0);
});

obviously you should add "$timeout" in the dependencies.

simonepri avatar Aug 19 '16 09:08 simonepri