[pointerevents] Introduce contextmenuclose or similar event. (#615)

flackr has just created a new issue for https://github.com/w3c/pointerevents:

== Introduce contextmenuclose or similar event. ==
There is a [contextmenu event](https://html.spec.whatwg.org/multipage/indices.html#event-contextmenu) fired when the user right clicks or long presses (with touch) to show a context menu (Note w3c/uievents#279 proposes adding this event to UI Events). There is however no notification about the closing of that menu. Developers typically call preventDefault() on the contextmenu event to create a custom menu, however they have to implement custom logic to try to detect under what circumstances it should close. There are many scenarios under which a contextmenu should be closed, that would be easier to handle given a single event to listen for:

- Escape key pressed
- When focusing any other window
- Clicking outside of the browser window
- When interacting with touch it is common to initiate a contextmenu after a long press. However, if the item being pressed is also draggable than a subsequent drag of the finger can be used to initiate a drag which implicitly cancels the contextmenu.

I propose adding a contextmenuclose (or contextmenucancel or contextmenudismiss) event which will be dispatched under the conditions when the platform would close a native contextmenu.

Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/615 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 12 January 2026 22:04:29 UTC