Fix: Enter key in bulk metadata edit triggers form submit instead of adding a genre (#1234)
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@
|
||||
Checking <strong>Clear</strong> will remove that field’s metadata from <strong>all selected books</strong>.
|
||||
</div>
|
||||
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 w-full p-4">
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSubmit()" (keydown)="onFormKeydown($event)" class="flex flex-col gap-4 w-full p-4">
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="authors" class="flex items-center justify-between gap-2">
|
||||
|
||||
+10
@@ -101,6 +101,16 @@ export class BulkMetadataUpdateComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onFormKeydown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Enter') {
|
||||
if ((event.target as HTMLElement)?.tagName === 'BUTTON' &&
|
||||
(event.target as HTMLButtonElement)?.type === 'submit') {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
if (!this.metadataForm.valid) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user