From: Alexander Ebert Date: Tue, 24 Aug 2021 21:53:37 +0000 (+0200) Subject: Prevent the default action of a toggle button X-Git-Tag: 5.4.5_RC_1~20 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc4e762ee6bd3444b80f3dbe0db545b07c655317;p=GitHub%2FWoltLab%2FWCF.git Prevent the default action of a toggle button --- 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