From 9d19b7f70192e0a69ec389ecd08edd45eb72bfe4 Mon Sep 17 00:00:00 2001 From: Fabrice Daugan Date: Mon, 4 Aug 2014 22:50:22 +0200 Subject: [PATCH] Redirect the focus of original input to Select2 Redirect the focus of original input to the "focus" event of Select2. this way, we get back the accessible label for feature of previous Select2 versions. --- select2.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/select2.js b/select2.js index fa4d21a7..0aecaefb 100644 --- a/select2.js +++ b/select2.js @@ -2096,6 +2096,7 @@ the specific language governing permissions and limitations under the Apache Lic this.focusser.attr("id", "s2id_autogen"+idSuffix); elementLabel = $("label[for='" + this.opts.element.attr("id") + "']"); + this.opts.element.focus(this.bind(function () { this.focus(); })); this.focusser.prev() .text(elementLabel.text()) @@ -2686,6 +2687,7 @@ the specific language governing permissions and limitations under the Apache Lic this.search.prev() .text($("label[for='" + this.opts.element.attr("id") + "']").text()) .attr('for', this.search.attr('id')); + this.opts.element.focus(this.bind(function () { this.focus(); })); this.search.on("input paste", this.bind(function() { if (this.search.attr('placeholder') && this.search.val().length == 0) return;