aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob <[email protected]>2014-10-02 21:26:38 -0700
committerJacob <[email protected]>2014-10-02 21:26:38 -0700
commit3fda099f5c69fe1cb7a217aaecf73a7131a4d513 (patch)
tree67b47f95c62ee0b2609df79e58f3032df6f25e2e
parent76268c4b965c247ba012fba257c9b6400d0533eb (diff)
parente5fc22ccfa39b792ff6702cb496079c77bf7162f (diff)
downloadbootstrap-3fda099f5c69fe1cb7a217aaecf73a7131a4d513.tar.xz
bootstrap-3fda099f5c69fe1cb7a217aaecf73a7131a4d513.zip
Merge pull request #14722 from twbs/fat-14646
Escape key should only close Dropdown
-rw-r--r--js/dropdown.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/js/dropdown.js b/js/dropdown.js
index 756fc21f5..8fa712775 100644
--- a/js/dropdown.js
+++ b/js/dropdown.js
@@ -55,7 +55,7 @@
}
Dropdown.prototype.keydown = function (e) {
- if (!/(38|40|27)/.test(e.keyCode)) return
+ if (!/(38|40|27|32)/.test(e.which)) return
var $this = $(this)
@@ -67,7 +67,7 @@
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
- if (!isActive || (isActive && e.keyCode == 27)) {
+ if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
@@ -79,8 +79,8 @@
var index = $items.index($items.filter(':focus'))
- if (e.keyCode == 38 && index > 0) index-- // up
- if (e.keyCode == 40 && index < $items.length - 1) index++ // down
+ if (e.which == 38 && index > 0) index-- // up
+ if (e.which == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items.eq(index).trigger('focus')