Fix enter key was prevented

This commit is contained in:
Michael Shamoon 2022-03-11 08:11:35 -08:00
parent 4773d0bb7f
commit 4e4035a867
2 changed files with 2 additions and 2 deletions

View File

@ -122,7 +122,7 @@ export class DateDropdownComponent implements OnInit, OnDestroy {
// prevent chars other than numbers and separators // prevent chars other than numbers and separators
onKeyPress(event: KeyboardEvent) { onKeyPress(event: KeyboardEvent) {
if (!/[0-9,\.\/-]+/.test(event.key)) { if ('Enter' !== event.key && !/[0-9,\.\/-]+/.test(event.key)) {
event.preventDefault() event.preventDefault()
} }
} }

View File

@ -29,7 +29,7 @@ export class DateComponent extends AbstractInputComponent<string> implements OnI
// prevent chars other than numbers and separators // prevent chars other than numbers and separators
onKeyPress(event: KeyboardEvent) { onKeyPress(event: KeyboardEvent) {
if (!/[0-9,\.\/-]+/.test(event.key)) { if ('Enter' !== event.key && !/[0-9,\.\/-]+/.test(event.key)) {
event.preventDefault() event.preventDefault()
} }
} }