Skip to content

Commit

Permalink
Merge pull request #1785 from bcgov/bugfix/ALCS-2065-3
Browse files Browse the repository at this point in the history
Prevent User From Submitting an Invalid Inline Number Form by Enter Key
  • Loading branch information
Abradat authored Jul 8, 2024
2 parents f1501d2 + 4b7de21 commit ea3eb25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
name="value"
[placeholder]="placeholder"
#editInput
(keydown.enter)="confirmEdit()"
(keydown.enter)="!valueControl.invalid ? confirmEdit(): preventKeydown($event)"
(keydown.escape)="cancelEdit()"
[formControl]="valueControl"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ export class InlineNumberComponent implements AfterContentChecked {
this.isEditing = false;
this.valueControl.setValue(this.value);
}

preventKeydown(event: Event) {
const keyboardEvent = event as KeyboardEvent;
keyboardEvent.preventDefault();
}
}

0 comments on commit ea3eb25

Please sign in to comment.