From 59ad1e5e366f6b601fcaa816be00e593918cef33 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Tue, 10 Jan 2023 22:58:20 +0100 Subject: [PATCH] Toggle switch shouldn't submit form This patch fixes the problem that toggling one of the options in the user account dialog will automatically submit the form. The problem got introduced as a combination of the recent accessibility fixes where some elements got turned into HTML button elements to make them keyboard accessible. Doing that, I did not realize that the default type of a button is `submit` [1]. This causes no problems at most places, but will cause problem within a form (e.g. the user account settings) where toggling an option is now identical to clicking submit. This patch fixes the issue by setting the `type` attribute to `button`. Not only for the toggle switch, but also for a few other elements which have been recently converted to buttons. [1] https://www.w3.org/TR/2011/WD-html5-20110525/the-button-element.html#attr-button-type --- client/components/app/SettingsContent.vue | 2 +- client/components/tables/UsersTable.vue | 4 ++-- client/components/ui/ToggleSwitch.vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/components/app/SettingsContent.vue b/client/components/app/SettingsContent.vue index b6dbd6ae..233839e7 100644 --- a/client/components/app/SettingsContent.vue +++ b/client/components/app/SettingsContent.vue @@ -4,7 +4,7 @@

{{ headerText }}

- +
diff --git a/client/components/tables/UsersTable.vue b/client/components/tables/UsersTable.vue index 2f19a7ba..79876ca3 100644 --- a/client/components/tables/UsersTable.vue +++ b/client/components/tables/UsersTable.vue @@ -38,10 +38,10 @@
- +
- +
diff --git a/client/components/ui/ToggleSwitch.vue b/client/components/ui/ToggleSwitch.vue index 0806ff82..b5511d96 100644 --- a/client/components/ui/ToggleSwitch.vue +++ b/client/components/ui/ToggleSwitch.vue @@ -1,6 +1,6 @@