From a2b24cd13e481ee6dd956c3ccb74cfc97523188f Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Thu, 7 Sep 2017 20:13:17 +0200
Subject: [PATCH] [BUGFIX] SplitButtons: Abort click event if requested

If any callback is registered by `SplitButtons.addPreSubmitCallback()` and
requests to stop the event by `stopPropagation()`, the event must be
aborted and not only possibly stacked events.
Additionally, the `preventExec` flag gets reset.

Resolves: #82355
Related: #77942
Releases: master, 8.7, 7.6
Change-Id: Ib8478ef4c51915365c804c1c408b3fc16a13da0b
Reviewed-on: https://review.typo3.org/53968
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Matthias Vogel <typo3@kanti.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../backend/Resources/Public/JavaScript/SplitButtons.js      | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js b/typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js
index 71fda54ac667..57cc99fc611b 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js
@@ -58,6 +58,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
 				// Run any preSubmit callbacks
 				for (var i = 0; i < SplitButtons.preSubmitCallbacks.length; ++i) {
 					SplitButtons.preSubmitCallbacks[i](e);
+
+					if (e.isPropagationStopped()) {
+						preventExec = false;
+						return false;
+					}
 				}
 				$form.append($elem);
 				// Disable submit buttons
-- 
GitLab