Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand explanation for compatibility mouse events
Browse files Browse the repository at this point in the history
* Add note about high level "interleaved" events, and the reality of what user agents may do, especially on touchscreens, as long as the relative order is consistent

Closes #454
patrickhlauke committed Oct 24, 2022

Verified

This commit was signed with the committer’s verified signature.
matthewnessworthy Matthew Nessworthy
1 parent 1074161 commit 8835a85
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
@@ -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>). This may result in compatibility mouse events only being dispatched after {{GlobalEventHandlers/pointerup}}, 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>

0 comments on commit 8835a85

Please sign in to comment.