We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37ff4bb commit 3fc1bc6Copy full SHA for 3fc1bc6
1 file changed
select2.js
@@ -380,6 +380,8 @@
380
381
/**
382
* blurs any Select2 container that has focus when an element outside them was clicked or received focus
383
+ *
384
+ * also takes care of clicks on label tags that point to the source element
385
*/
386
$(document).ready(function () {
387
$(document).delegate("*", "mousedown touchend", function (e) {
@@ -394,6 +396,13 @@
394
396
if (this !== target) $(this).data("select2").blur();
395
397
});
398
}
399
+
400
+ target=$(e.target);
401
+ if ("LABEL" === e.target.tagName && target.attr("for").length > 0) {
402
+ target = $("#"+target.attr("for"));
403
+ target = target.data("select2");
404
+ if (target !== undefined) { target.focus(); e.preventDefault();}
405
+ }
406
407
408
0 commit comments