From 1d55ada581e2e669cc7c163dc469b9184bbd8f7d Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Wed, 12 Nov 2014 01:18:06 +0100 Subject: [PATCH] Dropdown: ignore keydown events coming from `input`s and `textarea`s Fixes #15084. --- js/dropdown.js | 2 +- js/tests/unit/dropdown.js | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/js/dropdown.js b/js/dropdown.js index ae192e570d..64ec34d5d8 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -55,7 +55,7 @@ } Dropdown.prototype.keydown = function (e) { - if (!/(38|40|27|32)/.test(e.which)) return + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 335795fde8..3cdf637ee0 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -224,4 +224,45 @@ $(function () { $(document.body).click() }) + test('should ignore keyboard events within s and