Open bicarlsen opened 3 months ago
From the MDN page you link:
A PointerEvent. Inherits from MouseEvent. ... Note: In earlier versions of the specification the event type for this event was a MouseEvent, and this is still the type passed in Firefox and Safari.
i.e., the spec says PointerEvent
, but Firefox, Safari, and (maybe?) older versions of all browsers will give you a MouseEvent
. PointerEvent
inherits from MouseEvent
, so you can use any MouseEvent
methods or fields if you're using a browser that gives you a PointerEvent
, but you cannot actually assume that you are getting a PointerEvent
. Writing code that assumes a PointerEvent
will likely fail at runtime on some browsers in a way that is not obvious if you're developing on Chrome, as it will work there.
To me, this suggests that the best course of action is to keep it as a MouseEvent
and allow you to cast it to PointerEvent
using .dyn_into()
, and handle the case where it's actually a MouseEvent
however you need to for your application. Thoughts?
Seems good to me. Perhaps it's worth a mention in the docs?
Describe the bug The
contextmenu
event expects aMouseEvent
but MDN states it should accept aPointerEvent
.Leptos Dependencies
To Reproduce N/A
Expected behavior N/A
Screenshots N/A
Additional context N/A