From dc4e762ee6bd3444b80f3dbe0db545b07c655317 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 24 Aug 2021 23:53:37 +0200 Subject: [PATCH] Prevent the default action of a toggle button --- ts/WoltLabSuite/Core/Ui/Object/Action.ts | 2 ++ wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Object/Action.js | 1 + 2 files changed, 3 insertions(+) diff --git a/ts/WoltLabSuite/Core/Ui/Object/Action.ts b/ts/WoltLabSuite/Core/Ui/Object/Action.ts index 088ed1838a..34599d3be5 100644 --- a/ts/WoltLabSuite/Core/Ui/Object/Action.ts +++ b/ts/WoltLabSuite/Core/Ui/Object/Action.ts @@ -21,6 +21,8 @@ const objectSelector = ".jsObjectActionObject[data-object-id]"; const actionSelector = ".jsObjectAction[data-object-action]"; function executeAction(event: Event): void { + event.preventDefault(); + const actionElement = event.currentTarget as HTMLElement; const objectAction = actionElement.dataset.objectAction!; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Object/Action.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Object/Action.js index 291a1f4ad1..61f6c34270 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Object/Action.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Object/Action.js @@ -20,6 +20,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Event/Handler", "../ const objectSelector = ".jsObjectActionObject[data-object-id]"; const actionSelector = ".jsObjectAction[data-object-action]"; function executeAction(event) { + event.preventDefault(); const actionElement = event.currentTarget; const objectAction = actionElement.dataset.objectAction; // To support additional actions added by plugins, action elements can override the default object -- 2.20.1