From 54ea317c887b5640a64781298043f0bf6cf3a627 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Mon, 15 Jul 2024 16:33:41 +0530 Subject: [PATCH] Fix Empty form label --- select2.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/select2.js b/select2.js index ec10d9879f..f0f75e8be7 100644 --- a/select2.js +++ b/select2.js @@ -2004,6 +2004,9 @@ the specific language governing permissions and limitations under the Apache Lic this.focusser.attr("tabindex", this.elementTabIndex); + // use the accessible name in for the focusser label text if element label is not declared or empty + $("label[for='" + this.focusser.attr('id') + "']").text(originalTitle || elementLabel.text()); + // write label for search field using the label from the focusser element this.search.attr("id", this.focusser.attr('id') + '_search');