Skip to content

Commit

Permalink
Expand explanation for compatibility mouse events (#459)
Browse files Browse the repository at this point in the history
Expand explanation for compatibility mouse events

Add note about high level "interleaved" events, and the reality of what user agents may do while maintaining a consistent the relative order.

Closes #454

based on @mustaqahmed's suggestion
  • Loading branch information
patrickhlauke authored Oct 27, 2022
1 parent 58ce3bf commit 7276898
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,10 @@ <h2>Populating and maintaining the coalesced and predicted events lists</h2>
<h1><dfn data-lt="compatibility mouse events">Compatibility mapping with mouse events</dfn></h1>
<p>The vast majority of web content existing today codes only to Mouse Events. The following describes an algorithm for how the user agent MAY map generic pointer input to mouse events for compatibility with this content.</p>
<p>The compatibility mapping with mouse events is an OPTIONAL feature of this specification. User agents are encouraged to support the feature for best compatibility with existing legacy content.</p>
<div class="note">
<p>At a high level, compatibility mouse events are intended to be "interleaved" with their respective pointer events. However, this specific order is not mandatory, and user agents that implement compatibility mouse events MAY decide to delay or group the dispatch of mouse events, as long as their relative order is consistent.</p>
<p>Particularly in the case of touchscreen inputs, user agents MAY apply additional heuristics for gesture recognition (unless explicitly suppressed by authors through <a><code>touch-action</code></a>). During a sequence of events between a {{GlobalEventHandlers/pointerdown}} event and a {{GlobalEventHandlers/pointerup}} event, the gesture recognition may have to wait until the {{GlobalEventHandlers/pointerup}} event to detect or ignore a gesture. As a result the compatibility mouse events for the whole sequence may be dispatched together after the last {{GlobalEventHandlers/pointerup}} event, if the user agent determined that an interaction was not intended as a particular gesture. These specifics of user agent gesture recognition are not defined in this specification, and they may differ between implementations.</p>
</div>
<p>Regardless of their support for compatibility mouse events, the user agents MUST always support the <code>click</code>, <code>auxclick</code> and <code>contextmenu</code> events because these events are of type <code>PointerEvent</code> and are therefore not <a>compatibility mouse events</a>. Calling <code>preventDefault</code> during a pointer event MUST NOT have an effect on whether <code>click</code>, <code>auxclick</code>, or <code>contextmenu</code> are fired or not.</p>
<div class="note">
<p>The relative order of some of these high-level events (<code>contextmenu</code>, <code>focus</code>, <code>blur</code>, etc.) with pointer events is undefined and varies between user agents. For example, in some user agents <code>contextmenu</code> will often follow a {{GlobalEventHandlers/pointerup}}, while in others it'll often precede a {{GlobalEventHandlers/pointerup}} or {{GlobalEventHandlers/pointercancel}}, and in some situations it may be fired without any corresponding pointer event (for instance, as a result of a keyboard interaction).</p>
Expand Down

0 comments on commit 7276898

Please sign in to comment.