Skip to content

Commit 2e55383

Browse files
committed
Merge pull request select2#2610 from torke1/patch-1
Prevent multiple select2-hidden-accessible span's
2 parents c814143 + 651047d commit 2e55383

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

select2.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,15 @@ the specific language governing permissions and limitations under the Apache Lic
699699

700700
this.container = this.createContainer();
701701

702-
this.liveRegion = $("<span>", {
703-
role: "status",
704-
"aria-live": "polite"
705-
})
706-
.addClass("select2-hidden-accessible")
707-
.appendTo(document.body);
702+
this.liveRegion = $('.select2-hidden-accessible');
703+
if (this.liveRegion.length == 0) {
704+
this.liveRegion = $("<span>", {
705+
role: "status",
706+
"aria-live": "polite"
707+
})
708+
.addClass("select2-hidden-accessible")
709+
.appendTo(document.body);
710+
}
708711

709712
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
710713
this.containerEventName= this.containerId

0 commit comments

Comments
 (0)