-
-
Notifications
You must be signed in to change notification settings - Fork 834
bug: onClick returns MouseEvent Type #6217
Copy link
Copy link
Closed
Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within StencilHelp Wanted
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
latest
Current Behavior
Stencils onClick event is typed as
(event: MouseEvent) => ...
According to MDN and chrome debugging in modern browsers the on click event / "click" returns a PointerEvent that extends the MouseEvent.
If you inspect the callback of a stencil onClick event you will see that it returns the PointerEvent.
Only support MouseEvent is not wrong it's just if you want to type it correctly TS will complain
Expected Behavior
onClick should be typed to support both PointerEvent and MouseEvent, see:
https://developer.mozilla.org/de/docs/Web/API/Element/click_event
System Info
Steps to Reproduce
const button = document.querySelector("button");
button.addEventListener("click", (event) => {
button.textContent = `Click count: ${event.detail}`;
});
or JSX
<button onClick="this.eventHandler">
debug in browser dev tools the type is PointerEvent, in Stencil JSX Base only MouseEvent is supported but not PointerEvents.
Code Reproduction URL
http://......
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within StencilHelp Wanted
