From 651047d52acbb9b13a368125545b3ff89401207b Mon Sep 17 00:00:00 2001 From: torke1 Date: Wed, 13 Aug 2014 17:27:07 +0200 Subject: [PATCH] Issue #2412 Maybe the fix is a bit ugly, but what it does is to make sure that we don't already have a select2-hidden-accessible span before we create a new one. Tested in several scenarios in our application and has solved the issue for us. --- select2.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/select2.js b/select2.js index b6ebfd93..f94c5638 100644 --- a/select2.js +++ b/select2.js @@ -699,12 +699,15 @@ the specific language governing permissions and limitations under the Apache Lic this.container = this.createContainer(); - this.liveRegion = $("", { - role: "status", - "aria-live": "polite" - }) - .addClass("select2-hidden-accessible") - .appendTo(document.body); + this.liveRegion = $('.select2-hidden-accessible'); + if (this.liveRegion.length == 0) { + this.liveRegion = $("", { + role: "status", + "aria-live": "polite" + }) + .addClass("select2-hidden-accessible") + .appendTo(document.body); + } this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()); this.containerEventName= this.containerId