Skip to content

Commit

Permalink
Added a new event to communicate context menu dismissal.
Browse files Browse the repository at this point in the history
  • Loading branch information
mustaqahmed committed Oct 19, 2021
1 parent da40699 commit 509effe
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sections/event-interfaces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,17 @@ The following chart describes the inheritance structure of the interfaces descri
+-------------------+---o----+----o-----+-------o--------+--------o---------+-----o------+-------------------------------------------------+
+| abort | Sync | No | <a>Window</a>, | Event | No | None |
| | | | Element | | | |
+| auxclick | Sync | Yes | Element | PointerEvent | Yes | Varies |
+| beforeinput | Sync | Yes | Element | InputEvent | Yes | Update the DOM element |
+| blur | Sync | No | <a>Window</a>, | FocusEvent | No | None |
| | | | Element | | | |
+| click | Sync | Yes | Element | PointerEvent | Yes | Varies: for <a>targets</a> with an associated |
+| click | Sync | Yes | Element | MouseEvent | Yes | Varies: for <a>targets</a> with an associated |
| | | | | | | activation behavior, executes the <a>activation |
| | | | | | | behavior</a>; for focusable <a>targets</a>, |
| | | | | | | gives the element focus. |
+| compositionstart | Sync | Yes | Element | CompositionEvent | Yes | Show a <a>text composition system</a> candidate |
| | | | | | | window |
+| compositionupdate | Sync | Yes | Element | CompositionEvent | No | None |
+| compositionend | Sync | Yes | Element | CompositionEvent | No | None |
+| contextmenu | Sync | Yes | Element | PointerEvent | Yes | Invoke a context menu if supported |
+| dblclick | Sync | Yes | Element | MouseEvent | No | Varies: for <a>targets</a> with an associated |
| | | | | | | activation behavior, executes the <a>activation |
| | | | | | | behavior</a>; for focusable <a>targets</a>, |
Expand Down Expand Up @@ -120,7 +118,8 @@ The following chart describes the inheritance structure of the interfaces descri
+| mousemove | Sync | Yes | Element | MouseEvent | <a href="#mousemove-now-cancelable">Yes</a> | None |
+| mouseout | Sync | Yes | Element | MouseEvent | Yes | None |
+| mouseover | Sync | Yes | Element | MouseEvent | Yes | None |
+| mouseup | Sync | Yes | Element | MouseEvent | Yes | None |
+| mouseup | Sync | Yes | Element | MouseEvent | Yes | Invoke a context menu (in combination with the |
| | | | | | | right mouse button, if supported) |
+| select | Sync | Yes | Element | Event | No | None |
+| unload | Sync | No | <a>Window</a>, | Event | No | None |
| | | | Document, | | | |
Expand Down
45 changes: 45 additions & 0 deletions sections/event-types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,51 @@ myDiv.addEventListener("auxclick", function(e) {
before or after the EVENT{mouseup} event.
</p>

<h5 id="event-type-contextmenudismiss"><dfn>contextmenudismiss</dfn></h5>

++------------------+--------------------------------------------------------------------------------------+ event-definition
=| % | |
+------------------+--------------------------------------------------------------------------------------+
+| Type | <strong><code>contextmenudismiss</code></strong> |
+| Interface | {{PointerEvent}} |
+| Sync / Async | Async |
+| Bubbles | Yes |
+| Trusted Targets | <code>Element</code> |
+| Cancelable | No |
+| Composed | Yes |
+| Default action | None |
+| Context<br/> | <ul> |
| (trusted events) | <li>{{Event}}.{{Event/target}} : element which received the preceeding |
| | EVENT(contextmenu) event.</li> |
| | <li>{{UIEvent}}.{{UIEvent/view}} : <a><code>Window</code></a></li> |
| | <li>{{UIEvent}}.{{UIEvent/detail}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/screenX}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/screenY}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/clientX}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/clientY}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/altKey}} : <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/ctrlKey}} : <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/shiftKey}} : <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/metaKey}} : <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/button}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/buttons}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/relatedTarget}} : <code>null</code></li> |
| | </ul> |
++------------------+--------------------------------------------------------------------------------------+

A <a>user agent</a> MUST dispatch this event before closing a context menu.
If the system context menu has been suppressed by canceling the
EVENT{contextmenu} event, the <a>user agent</a> still MUST dispatch this
event to allow the page script to close a custom context menu under the same
condition like a system context menu.

Every EVENT{contextmenu} event MUST be followed by a corresponding
EVENT{contextmenudismiss} event with an identical
{{Event}}.{{Event/target}}. However, if the target of the
EVENT{contextmenu} event has been removed from DOM before firing the
EVENT{contextmenudismiss} event, the latter will be fired to the HTML
<a>body element</a>.

<h5 id="event-type-dblclick"><dfn>dblclick</dfn></h5>

++------------------+--------------------------------------------------------------------------------------+ event-definition
Expand Down

0 comments on commit 509effe

Please sign in to comment.