I have this html button:
<button
type='button'
class="button-name"
(click)="change($event)"
[disabled]='disabledButton'
>
I have this in typescript:
change(event: Event) {
console.log(event);
}
The problem is that when I hit ENTER on this button when is focused, it will trigger MouseEvent instead of Keyboard Event:
MouseEvent {type: "click", target: ..., ...}
Why does it fire MouseEvent on Enter? What's the best way to change it? The button should definitely works on both keyboard and mouse but because of some tracking and a11y running in the background, this results in incorrect behaviour.
Thanks anyone who can explain further why it is MouseEvent and suggest some solution.