Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(dropdown): exit keybind is not open
Browse files Browse the repository at this point in the history
- Exit keybindFilter if the $scope is not present

Closes #6278
Fixes #6208
  • Loading branch information
nmccready authored and wesleycho committed Oct 10, 2016
1 parent 58f1813 commit 14384fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])

this.close = function(dropdownScope, element) {
if (openScope === dropdownScope) {
openScope = null;
$document.off('click', closeDropdown);
$document.off('keydown', this.keybindFilter);
openScope = null;
}
};

Expand Down Expand Up @@ -57,6 +57,11 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
};

this.keybindFilter = function(evt) {
if (!openScope) {
// see this.close as ESC could have been pressed which kills the scope so we can not proceed
return;
}

var dropdownElement = openScope.getDropdownElement();
var toggleElement = openScope.getToggleElement();
var dropdownElementTargeted = dropdownElement && dropdownElement[0].contains(evt.target);
Expand Down

0 comments on commit 14384fc

Please sign in to comment.