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

Commit 14384fc

Browse files
nmccreadywesleycho
authored andcommitted
fix(dropdown): exit keybind is not open
- Exit keybindFilter if the $scope is not present Closes #6278 Fixes #6208
1 parent 58f1813 commit 14384fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dropdown/dropdown.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
2222

2323
this.close = function(dropdownScope, element) {
2424
if (openScope === dropdownScope) {
25-
openScope = null;
2625
$document.off('click', closeDropdown);
2726
$document.off('keydown', this.keybindFilter);
27+
openScope = null;
2828
}
2929
};
3030

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

5959
this.keybindFilter = function(evt) {
60+
if (!openScope) {
61+
// see this.close as ESC could have been pressed which kills the scope so we can not proceed
62+
return;
63+
}
64+
6065
var dropdownElement = openScope.getDropdownElement();
6166
var toggleElement = openScope.getToggleElement();
6267
var dropdownElementTargeted = dropdownElement && dropdownElement[0].contains(evt.target);

0 commit comments

Comments
 (0)