From 732ad030a04121dacad2030a43a45f7335349234 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Tue, 2 Oct 2012 10:09:31 -0700 Subject: [PATCH] fix tab index issues. fixes #408 --- select2.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 8127c929..eec31a66 100644 --- a/select2.js +++ b/select2.js @@ -1502,7 +1502,15 @@ })); this.search.bind("blur", this.bind(function() { if (!this.opened()) this.container.removeClass("select2-container-active"); - window.setTimeout(this.bind(function() { this.selection.attr("tabIndex", this.opts.element.attr("tabIndex")); }), 10); + window.setTimeout(this.bind(function() { + // restore original tab index + var ti=this.opts.element.attr("tabIndex"); + if (ti) { + this.selection.attr("tabIndex", ti); + } else { + this.selection.removeAttr("tabIndex"); + } + }), 10); })); selection.delegate("abbr", "mousedown", this.bind(function (e) {