Index: openacs-4/packages/acs-templating/tcl/head-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/head-procs.tcl,v diff -u -r1.45.2.38 -r1.45.2.39 --- openacs-4/packages/acs-templating/tcl/head-procs.tcl 6 Jul 2023 08:58:43 -0000 1.45.2.38 +++ openacs-4/packages/acs-templating/tcl/head-procs.tcl 31 Aug 2023 13:01:36 -0000 1.45.2.39 @@ -1002,12 +1002,17 @@ console.log("blocked double-click"); return false; } else { - target.dataset.oacsClicked = true; - target.classList.add("disabled"); - let timeout = target.dataset.oacsTimeout || $default_timeout; - console.log('reactivate in ' + timeout); - setTimeout(function() {oacs_reenable_double_click_handler(target);}, timeout); - setTimeout(function() {target.disabled = true;}); + // Disabling the button and re-enabling after + // the timeout must both be queued after all + // other click handlers have completed to ensure + // their correct execution order. + setTimeout(function () { + target.disabled = true; + target.dataset.oacsClicked = true; + target.classList.add("disabled"); + let timeout = target.dataset.oacsTimeout || $default_timeout; + setTimeout(oacs_reenable_double_click_handler, timeout, target); + }); return true; } }, true);