w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
145 stars 51 forks source link

We don't have a definition for "contextmenu" event #279

Closed mustaqahmed closed 2 years ago

mustaqahmed commented 3 years ago

Apparently no spec defines contextmenu event! The event is marked as a MouseEvent in a non-normative section in the HTML spec, that's it.

As of today, it seems UI Event spec would be the place for it because the event is a MouseEvent in all major browsers. Note, however, that we are planning to change it to a PointerEvent, see https://github.com/w3c/pointerevents/issues/100.

garykac commented 3 years ago

I have started documenting contextmenu in the algorithmic rewrite of uievents: https://w3c.github.io/uievents/event-algo.html

(also note the other hooks for PointerEvents in that document)

mustaqahmed commented 2 years ago

@garykac It seems to me that your algorithmic rewrite could be supplemented by a contextmenu event entry in the existing list of Mouse Event Types, which would provide non-algorithmic details like the event's attributes etc. I am working on a PR now to create that entry, please let me know your thoughts.

Herst commented 2 years ago

@mustaqahmed Please see https://stackoverflow.com/questions/47202631/discern-contextmenu-events-which-are-result-of-touch-action

mustaqahmed commented 2 years ago

@Herst The proposed PR makes "contextmenu" event a PointerEvent instance. So suppressing the context-menu from a touch interaction should be trivial: if (event.pointerType === "touch") event.preventDefault();