From b757fb987d3a4de1bcea8c9261ebb8b3bbd88bbf Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 28 Oct 2013 11:35:17 +0100 Subject: [PATCH] issue #1778: prevent delayed focus when the list is hidden This reset the focus color when the TAB key is pressed. --- select2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index a286377d..4236793f 100644 --- a/select2.js +++ b/select2.js @@ -1973,7 +1973,9 @@ the specific language governing permissions and limitations under the Apache Lic // without this the search field loses focus which is annoying if (document.activeElement === this.body().get(0)) { window.setTimeout(this.bind(function() { - this.search.focus(); + if (this.opened()) { + this.search.focus(); + } }), 0); } }));