Skip to content

Commit

Permalink
Skip display of loading animation when CMD, CTRL, or SHIFT is pressed…
Browse files Browse the repository at this point in the history
… (CO-2488) (#45)
  • Loading branch information
arlen authored Sep 5, 2022
1 parent e658231 commit 3e1b649
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/templates/element/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@
// Add loading animation when a form is submitted, when any item with a "spin" class is clicked,
// or on any anchor tag lacking the .nospin class. We do not automatically add this to buttons
// because they are often on-page controls. Add a "spin" class to buttons that need it.
$("input[type='submit'], a:not('.nospin'), .spin").click(function() {
$("input[type='submit'], 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();
}
}

});
Expand Down

0 comments on commit 3e1b649

Please sign in to comment.