settings: Open the date picker when its label has been clicked.

Flatpickr isn't a native input element, so clicking on its label
doesn't do anything. Add an event listener so that clicking on the
label will open the date picker.

Fixes part of #21769.
This commit is contained in:
joseph 2024-11-12 23:02:15 +00:00 committed by Tim Abbott
parent 4ab519214a
commit e237faabf5
1 changed files with 7 additions and 0 deletions

View File

@ -170,6 +170,13 @@ export function initialize_custom_date_type_fields(element_id: string): void {
static: true,
});
// Enable the label associated to this field to open the datepicker when clicked.
$(element_id)
.find(".custom_user_field label.settings-field-label")
.on("click", function () {
$(this).closest(".custom_user_field").find("input.datepicker").trigger("click");
});
$(element_id)
.find<HTMLInputElement>(".custom_user_field input.datepicker")
.on("mouseenter", function () {