From 47ba4747b3f7864dd7fc6d50190f1f6824452499 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Mon, 3 Feb 2025 23:20:20 +0400 Subject: [PATCH] Bail out early if submit button isn't present --- assets/js/upload.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/upload.js b/assets/js/upload.js index 0f931037..de2196ad 100644 --- a/assets/js/upload.js +++ b/assets/js/upload.js @@ -231,11 +231,14 @@ function setupImageUpload() { function disableUploadButton() { const submitButton = $('.button.input--separate-top'); - if (submitButton !== null) { - submitButton.disabled = true; - submitButton.innerText = 'Please wait...'; + + if (!submitButton) { + return; } + submitButton.disabled = true; + submitButton.innerText = 'Please wait...'; + // delay is needed because Safari stops the submit if the button is immediately disabled requestAnimationFrame(() => submitButton.setAttribute('disabled', 'disabled')); }