Skip to content
Merged

#131 #135

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,15 @@ export class NgOtpInputComponent implements OnInit, AfterViewInit, OnDestroy, Co
onKeyDown($event, inputIdx) {
const prevInputId = this.getBoxId(inputIdx - 1);
const currentInputId = this.getBoxId(inputIdx);
const nextInputId = this.getBoxId(inputIdx + 1);
if (KeyboardUtil.ifKey($event, 'Enter')) {
let inp = this.document.getElementById(currentInputId);
const form = inp?.closest('form');
if (form) {
$event.preventDefault();
form.dispatchEvent(new Event('submit'));
return;
}
}
if (KeyboardUtil.ifSpacebar($event)) {
$event.preventDefault();
return false;
Expand Down