From f9a7b8698fd2eb2985e304423ac5580fbf43c66d Mon Sep 17 00:00:00 2001 From: Sebastian Thulin Date: Mon, 8 Jan 2024 15:27:34 +0100 Subject: [PATCH] fix: prevent default on tab-bar items. --- assets/js/toolbar.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/toolbar.js b/assets/js/toolbar.js index c264d44..802e877 100644 --- a/assets/js/toolbar.js +++ b/assets/js/toolbar.js @@ -95,7 +95,8 @@ class FormNavigationManager { /* Cancel button */ const cancelButton = document.getElementById("cancel-button"); if (cancelButton) { - cancelButton.addEventListener("click", function () { + cancelButton.addEventListener("click", function (e) { + e.preventDefault(); const userConfirmed = window.confirm("Är du säker på att du vill avbryta? All inmatad information förloras."); if (userConfirmed == true) { reloadPage( @@ -108,7 +109,8 @@ class FormNavigationManager { /* Close button */ const closeButton = document.getElementById("close-button"); if (closeButton) { - closeButton.addEventListener("click", function () { + closeButton.addEventListener("click", function (e) { + e.preventDefault(); reloadPage( new URLSearchParams(window.location.search).get("closeUrl") ?? null );