[PR #1390] [MERGED] Toggle switch shouldn't submit form #3533

Closed
opened 2026-04-25 00:16:02 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/1390
Author: @lkiesow
Created: 1/10/2023
Status: Merged
Merged: 1/10/2023
Merged by: @advplyr

Base: masterHead: button-no-submit


📝 Commits (1)

  • 59ad1e5 Toggle switch shouldn't submit form

📊 Changes

3 files changed (+4 additions, -4 deletions)

View changed files

📝 client/components/app/SettingsContent.vue (+1 -1)
📝 client/components/tables/UsersTable.vue (+2 -2)
📝 client/components/ui/ToggleSwitch.vue (+1 -1)

📄 Description

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. 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/1390 **Author:** [@lkiesow](https://github.com/lkiesow) **Created:** 1/10/2023 **Status:** ✅ Merged **Merged:** 1/10/2023 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `button-no-submit` --- ### 📝 Commits (1) - [`59ad1e5`](https://github.com/advplyr/audiobookshelf/commit/59ad1e5e366f6b601fcaa816be00e593918cef33) Toggle switch shouldn't submit form ### 📊 Changes **3 files changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `client/components/app/SettingsContent.vue` (+1 -1) 📝 `client/components/tables/UsersTable.vue` (+2 -2) 📝 `client/components/ui/ToggleSwitch.vue` (+1 -1) </details> ### 📄 Description 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`](https://www.w3.org/TR/2011/WD-html5-20110525/the-button-element.html#attr-button-type). 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:16:02 +02:00
adam closed this issue 2026-04-25 00:16:02 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3533