Skip to content

Commit

Permalink
Modified the dist/angular-selector.js file to fix issue indrimuska#21
Browse files Browse the repository at this point in the history
…- Dropdown closing on scroll click in IE and Edge
  • Loading branch information
Rex Strowbridge authored and Rex Strowbridge committed Jan 9, 2017
1 parent a83415a commit fb6e170
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,27 @@
}, true);

// DOM event listeners
scope.preventClose = false;

input = angular.element(element[0].querySelector('.selector-input input'))
.on('focus', function () {

if(scope.preventClose) {
scope.preventClose = false;
return;
}

$timeout(function () {
scope.$apply(scope.open);
});
})
.on('blur', function () {

if(scope.preventClose) {
input.focus();
return;
}

scope.$apply(scope.close);
})
.on('keydown', function (e) {
Expand All @@ -531,6 +545,7 @@
});
dropdown
.on('mousedown', function (e) {
scope.preventClose = true;
e.preventDefault();
});
angular.element($window)
Expand Down

0 comments on commit fb6e170

Please sign in to comment.