I have implemented a functionality like, while click of enter key on any where in form it should hit submit button. Now this functionality is working fine, but problem is on top of my form one modal window will open for some scenario. On that window If user click enter it is hitting background form submit button. Here I'm expecting until closing modal it shouldn't hit to submit button. Here I'm unable to control Enter key on modal.
This is my code snippet:
@HostListener('document:keydown', ['$event'])
keyboardInput(event: KeyboardEvent) {
this.onKeydown(event);
}
onKeydown(event:KeyboardEvent):void {
if (event.keyCode === 13) {
this.submit();
}
}