I'm encountering an issue with a component that has a button. I've implemented a simple HostListener to display a notification when the ALT + Q shortcut is triggered.
@HostListener('window:keydown.alt.q', ['$event'])
displayNotification(event: KeyboardEvent) {
event.preventDefault();
this.messageService.add({
severity: 'success',
detail: 'Finished',
life: 5
});
}
The problem is that the notification only appears after clicking on the component. Any ideas on what might be causing this and how to fix it?
Thank you!