Skip to content

Commit

Permalink
Add a definition of contextmenu event. (#316)
Browse files Browse the repository at this point in the history
Add a definition of `contextmenu` event.
  • Loading branch information
mustaqahmed authored Oct 15, 2021
1 parent d2c79ab commit 6753ebf
Showing 1 changed file with 51 additions and 6 deletions.
57 changes: 51 additions & 6 deletions sections/event-types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,56 @@ myDiv.addEventListener("auxclick", function(e) {
* If the <a>event target</a> is focusable, the <a>default
action</a> MUST be to give that element document focus.

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

++------------------+--------------------------------------------------------------------------------------+ event-definition
=| % | |
+------------------+--------------------------------------------------------------------------------------+
+| Type | <strong><code>contextmenu</code></strong> |
+| Interface | {{PointerEvent}} |
+| Sync / Async | Sync |
+| Bubbles | Yes |
+| Trusted Targets | <code>Element</code> |
+| Cancelable | Yes |
+| Composed | Yes |
+| Default action | Invoke a context menu if supported. |
+| Context<br/> | <ul> |
| (trusted events) | <li>{{Event}}.{{Event/target}} : <a>topmost event target</a></li> |
| | <li>{{UIEvent}}.{{UIEvent/view}} : <a><code>Window</code></a></li> |
| | <li>{{UIEvent}}.{{UIEvent/detail}} : 0</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/screenX}} : value based on the pointer position on |
| | the screen</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/screenY}} : value based on the pointer position on |
| | the screen</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/clientX}} : value based on the pointer position |
| | within the viewport</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/clientY}} : value based on the pointer position |
| | within the viewport</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/altKey}} : <code>true</code> if KEYCAP{Alt} |
| | modifier was active, otherwise <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/ctrlKey}} : <code>true</code> if KEYCAP{Control} |
| | modifier was active, otherwise <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/shiftKey}} : <code>true</code> if KEYCAP{Shift} |
| | modifier was active, otherwise <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/metaKey}} : <code>true</code> if KEYCAP{Meta} |
| | modifier was active, otherwise <code>false</code></li> |
| | <li>{{MouseEvent}}.{{MouseEvent/button}} : value based on current button pressed</li>|
| | <li>{{MouseEvent}}.{{MouseEvent/buttons}} : value based on all buttons currently |
| | depressed, <code>0</code> if no buttons pressed</li> |
| | <li>{{MouseEvent}}.{{MouseEvent/relatedTarget}} : <code>null</code></li> |
| | </ul> |
++------------------+--------------------------------------------------------------------------------------+

A <a>user agent</a> MUST dispatch this event before invoking a context menu.

When the EVENT{contextmenu} event is triggered by right mouse button, the
EVENT{contextmenu} event MUST be dispatched after the EVENT{mousedown} event.

<p class="note">
Depending on the platform, the EVENT{contextmenu} event may be dispatched
before or after the EVENT{mouseup} event.
</p>

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

++------------------+--------------------------------------------------------------------------------------+ event-definition
Expand Down Expand Up @@ -1883,7 +1933,7 @@ myDiv.addEventListener("auxclick", function(e) {
+| Trusted Targets | <code>Element</code> |
+| Cancelable | Yes |
+| Composed | Yes |
+| Default action | Invoke a context menu (in combination with the right mouse button, if supported) |
+| Default action | None |
+| Context<br/> | <ul> |
| (trusted events) | <li>{{Event}}.{{Event/target}} : <a>topmost event target</a></li> |
| | <li>{{UIEvent}}.{{UIEvent/view}} : <a><code>Window</code></a></li> |
Expand Down Expand Up @@ -1915,11 +1965,6 @@ myDiv.addEventListener("auxclick", function(e) {
A <a>user agent</a> MUST dispatch this event when a pointing device
button is released over an element.

<p class="note">
Many implementations will invoke a context menu as the default
action of this event if the right mouse button is being released.
</p>

<p class="note">
In some implementation environments, such as a browser, a
EVENT{mouseup} event can be dispatched even if the pointing device
Expand Down

0 comments on commit 6753ebf

Please sign in to comment.