From 0bc9f3e32265be5c5ac4cd8a414f9a45c5504f8c Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Sun, 2 May 2021 09:16:29 +1000 Subject: [PATCH] Fix textboxes inside flatpickr popup to not cause the scheduled publishing overlay to submit when enter is pressed. --- .../views/content/overlays/schedule.controller.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js index 2de526b503de..a69de224dded 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js @@ -121,11 +121,25 @@ * @param {any} type publish or unpublish */ function datePickerShow(variant, type) { + var activeDatePickerInstance; if (type === 'publish') { variant.releaseDatePickerOpen = true; + activeDatePickerInstance = variant.releaseDatePickerInstance; } else if (type === 'unpublish') { variant.expireDatePickerOpen = true; + activeDatePickerInstance = variant.expireDatePickerInstance; } + + // Prevent enter key in time fields from submitting the overlay before the associated input gets the updated time + if (activeDatePickerInstance && !activeDatePickerInstance.hourElement.hasAttribute("overlay-submit-on-enter")) + { + activeDatePickerInstance.hourElement.setAttribute("overlay-submit-on-enter", "false"); + } + if (activeDatePickerInstance && !activeDatePickerInstance.minuteElement.hasAttribute("overlay-submit-on-enter")) + { + activeDatePickerInstance.minuteElement.setAttribute("overlay-submit-on-enter", "false"); + } + checkForBackdropClick(); $scope.model.disableSubmitButton = !canSchedule(); }