Browse Source

fix tabindex for both multi and single. fixes #1169

Igor Vaynberg 12 years ago
parent
commit
45995d0f34
1 changed files with 6 additions and 3 deletions
  1. 6 3
      select2.js

+ 6 - 3
select2.js

@@ -649,8 +649,6 @@ the specific language governing permissions and limitations under the Apache Lic
             this.results = results = this.container.find(resultsSelector);
             this.results = results = this.container.find(resultsSelector);
             this.search = search = this.container.find("input.select2-input");
             this.search = search = this.container.find("input.select2-input");
 
 
-            this.container.find(".select2-focusser").attr("tabindex", this.elementTabIndex);
-
             this.resultsPage = 0;
             this.resultsPage = 0;
             this.context = null;
             this.context = null;
 
 
@@ -1707,7 +1705,7 @@ the specific language governing permissions and limitations under the Apache Lic
         // single
         // single
         initContainer: function () {
         initContainer: function () {
 
 
-            var selection,
+            var sel0ection,
                 container = this.container,
                 container = this.container,
                 dropdown = this.dropdown,
                 dropdown = this.dropdown,
                 clickingInside = false;
                 clickingInside = false;
@@ -1720,9 +1718,12 @@ the specific language governing permissions and limitations under the Apache Lic
 
 
             // rewrite labels from original element to focusser
             // rewrite labels from original element to focusser
             this.focusser.attr("id", "s2id_autogen"+nextUid());
             this.focusser.attr("id", "s2id_autogen"+nextUid());
+
             $("label[for='" + this.opts.element.attr("id") + "']")
             $("label[for='" + this.opts.element.attr("id") + "']")
                 .attr('for', this.focusser.attr('id'));
                 .attr('for', this.focusser.attr('id'));
 
 
+            this.focusser.attr("tabindex", this.elementTabIndex);
+
             this.search.bind("keydown", this.bind(function (e) {
             this.search.bind("keydown", this.bind(function (e) {
                 if (!this.enabled) return;
                 if (!this.enabled) return;
 
 
@@ -2185,6 +2186,8 @@ the specific language governing permissions and limitations under the Apache Lic
                 }
                 }
             }));
             }));
 
 
+            this.search.attr("tabindex", this.elementTabIndex);
+
             this.search.bind("keydown", this.bind(function (e) {
             this.search.bind("keydown", this.bind(function (e) {
                 if (!this.enabled) return;
                 if (!this.enabled) return;