mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-31 02:17:01 -04:00 
			
		
		
		
	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
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <div class="bg-bg rounded-md shadow-lg border border-white border-opacity-5 p-4 mb-8">
 | |
|     <div class="flex items-center mb-2">
 | |
|       <h1 class="text-xl">{{ headerText }}</h1>
 | |
| 
 | |
|       <div v-if="showAddButton" class="mx-2 w-7 h-7 flex items-center justify-center rounded-full cursor-pointer hover:bg-white hover:bg-opacity-10 text-center" @click="clicked">
 | |
|         <button type="button" class="material-icons" :aria-label="$strings.ButtonAdd + ': ' + headerText" style="font-size: 1.4rem">add</button>
 | |
|       </div>
 | |
|     </div>
 | |
| 
 | |
|     <p v-if="description" id="settings-description" class="mb-6 text-gray-200" v-html="description" />
 | |
| 
 | |
|     <slot></slot>
 | |
|   </div>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| export default {
 | |
|   props: {
 | |
|     headerText: String,
 | |
|     description: String,
 | |
|     note: String,
 | |
|     showAddButton: Boolean
 | |
|   },
 | |
|   methods: {
 | |
|     clicked() {
 | |
|       this.$emit('clicked')
 | |
|     }
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| 
 | |
| <style>
 | |
| #settings-description a {
 | |
|   color: rgb(96 165 250);
 | |
| }
 | |
| #settings-description a:hover {
 | |
|   color: rgb(147 197 253);
 | |
|   text-decoration-line: underline;
 | |
| }
 | |
| #settings-description code {
 | |
|   font-size: 0.875rem;
 | |
|   border-radius: 6px;
 | |
|   background-color: rgb(82, 82, 82);
 | |
|   color: white;
 | |
|   padding: 2px 4px;
 | |
| }
 | |
| </style> |