From 658df39f5cbc87568f8a07ad955549be7f0cf6f3 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Mon, 5 Sep 2022 16:40:29 -0400 Subject: [PATCH] Skip display of loading animation when CMD, CTRL, or SHIFT is pressed (CO-2488) (#41) --- app/templates/element/javascript.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/templates/element/javascript.php b/app/templates/element/javascript.php index 361b0f8d3..352f7b476 100644 --- a/app/templates/element/javascript.php +++ b/app/templates/element/javascript.php @@ -178,13 +178,16 @@ // Add loading animation when a form is submitted, when any item with a "spin" class is clicked, // or on any button or anchor tag lacking the .nospin class. - $("input[type='submit'], button:not(.nospin), a:not(.nospin), .spin").click(function() { + $("input[type='submit'], button:not(.nospin), a:not(.nospin), .spin").click(function(e) { - displaySpinner(); + // Start a spinner only if CTRL, CMD, or SHIFT is not pressed (which loads a new tab or window). + if(!(e.ctrlKey || e.metaKey || e.shiftKey)) { + displaySpinner(); - // Test for invalid fields (HTML5) and turn off spinner explicitly if found - if(document.querySelectorAll(":invalid").length) { - stopSpinner(); + // Test for invalid fields (HTML5) and turn off spinner explicitly if found + if (document.querySelectorAll(":invalid").length) { + stopSpinner(); + } } });