This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Datepicker is-open issue with ng-focus #2548
Labels
Comments
This was referenced Aug 6, 2014
+1 for this |
We really need this fixed! |
This issue is solved using $timeout. This way: var focusElement = function() {
$timeout(function() {
element[0].focus();
}, 0 , false);
};
// Listen for focus requests from popup directive
scope.$on('datepicker.focus', focusElement); and replacing element[0].focus(); by
scope.$broadcast('datepicker.focus'); but the issue is that it generates a loop so the popup never closes. Looks like this was solved in 0.10.0 version. |
This is still broken in 0.12.0 |
+1 for this |
The issue appears to be here: if ( closeOnDateSelection ) {
scope.isOpen = false;
element[0].focus();
} This can be fixed by wrapping the focus in a timeout: if ( closeOnDateSelection ) {
scope.isOpen = false;
safeFocus();
}
function safeFocus() {
$timeout(function () {
element[0].focus();
}, 0);
} |
I am not seeing this issue with angular 1.3, but would like to +1 an option to open-on-focus (#2303) |
This issue looks fixed in |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
When I do :
<input type="text" is-open="date_open" ng-focus="date_open = true" datepicker-popup="MM/dd/yyyy" ng-model="myDate" />
I have the following error in the console :
$apply already in progress
see http://plnkr.co/edit/ZEvAW1v033aaEBFfiytF
If I use
ng-click
, it works.The error seems to be caused by the line 1503 :
element[0].focus();
PS : An option to (re)enable the automatic opening would be appreciate :)
The text was updated successfully, but these errors were encountered: