From 0d6ba9714405ae5f1f1f277f843f61ce0a775c90 Mon Sep 17 00:00:00 2001 From: Grzegorz Klimek Date: Thu, 13 Dec 2012 10:39:34 +0100 Subject: [PATCH] Update select2.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jQuery("input#someId").attr("tabIndex") don't work well in new jQuery 1.8+. When you try this on field  that don't have tabIndex attr you get undefined (but document.getElementById("someId").tabIndex returns '0'). This is why Select2 element onBlur stay whit attr tabindex='-1' and you can't navigate form with 'tab' key. This simple ' || 0' fix this bug. --- select2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 767e4fce..bf436b69 100644 --- a/select2.js +++ b/select2.js @@ -1522,7 +1522,7 @@ the specific language governing permissions and limitations under the Apache Lic if (!this.opened()) this.container.removeClass("select2-container-active"); window.setTimeout(this.bind(function() { // restore original tab index - var ti=this.opts.element.attr("tabIndex"); + var ti=this.opts.element.attr("tabIndex") || 0; if (ti) { this.selection.attr("tabIndex", ti); } else { @@ -1565,7 +1565,7 @@ the specific language governing permissions and limitations under the Apache Lic if (!this.opened()) { this.container.removeClass("select2-container-active"); } - window.setTimeout(this.bind(function() { this.search.attr("tabIndex", this.opts.element.attr("tabIndex")); }), 10); + window.setTimeout(this.bind(function() { this.search.attr("tabIndex", this.opts.element.attr("tabIndex") || 0); }), 10); })); selection.bind("keydown", this.bind(function(e) {