Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about rounding coordinates for click, auxclick, contextmenu #404

Merged
25 changes: 19 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ <h2><code>PointerEvent</code> interface</h2>
<a data-cite="ECMASCRIPT#sec-math.round">Math.round</a> [[ECMASCRIPT]] rules.</p>
</div>

<div class="note">The <code>PointerEvent</code> interface inherits from {{MouseEvent}}, defined in [[[UIEVENTS]]] and extended by [[[CSSOM-VIEW]]].</div>
<div class="note">The <code>PointerEvent</code> interface inherits from {{MouseEvent}}, defined in [[[UIEVENTS]]].
Also note the proposed extension in [[[CSSOM-VIEW]]], which changes the various coordinate properties from <code>long</code>
to <code>double</code> to allow for fractional coordinates. For user agents that already implement this proposed extension for
{{PointerEvent}}, but <em>not</em> for regular {{MouseEvent}}, there are additional requirements when it comes to
the <a><code>click</code>, <code>auxclick</code>, and <code>contextmenu</code> events</a>.</div>
</div>
<section>
<h2>Button states</h2>
Expand Down Expand Up @@ -634,11 +638,20 @@ <h3>The <dfn data-lt="lostpointercapture"><code>lostpointercapture</code> event<
<h3>The <dfn><code>click</code>, <code>auxclick</code>, and <code>contextmenu</code> events</dfn></h3>
<p>This section is an addition to <a data-cite="uievents/#event-type-click">click</a> and
<a data-cite="uievents/#event-type-auxclick">auxclick</a> events defined in [[UIEVENTS]] and
[=HTMLElement/contextmenu=] defined in [[HTML]].
The type of these events MUST be <code>PointerEvent</code> but the dispatch process is going to match that of the original specification.
For these events, all <code>PointerEvent</code> specific attributes (defined in this spec) other than <code>pointerId</code> and <code>pointerType</code> will have their default values.
The <code>pointerId</code> and <code>pointerType</code> of these events MUST be the same as the PointerEvents that caused these events if they are generated by a pointing device.
If the events are generated by a non-pointing device (such as voice recognition software or a keyboard interaction), <code>pointerId</code> MUST be <code>-1</code> and <code>pointerType</code> MUST be an empty string.</p>
[=HTMLElement/contextmenu=] defined in [[HTML]]. The type of these events MUST be <code>PointerEvent</code>,
but the dispatch process is going to match that of the original specification.</p>
For these events, all <code>PointerEvent</code> specific attributes (defined in this spec) other than <code>pointerId</code> and <code>pointerType</code> will have their default values. In addition:</p>
<ul>
<li>If the events are generated by a pointing device, their <code>pointerId</code> and <code>pointerType</code> MUST be the same as the PointerEvents that caused these events.</li>
<li>If the events are generated by a non-pointing device (such as voice recognition software or a keyboard interaction), <code>pointerId</code> MUST be <code>-1</code> and <code>pointerType</code> MUST be an empty string.</li>
</ul>
<p>As noted in {{PointerEvent}}, [[[CSSOM-VIEW]]] proposes to redefine the various coordinate properties (<code>screenX</code>, <code>screenY</code>, <code>pageX</code>, <code>pageY</code>, <code>clientX</code>,
<code>clientY</code>, <code>x</code>, <code>y</code>, <code>offsetX</code>, <code>offsetY</code>) as <code>double</code>, to allow for fractional coordinates.
However, this change — when applied only to {{PointerEvent}}, but not to regular {{MouseEvent}} — has proven to lead to web compatibility issues with legacy code
in the case of <code>click</code>, <code>auxclick</code>, and <code>contextmenu</code>. For this reason, user agents that have implemented the proposed
change in [[[CSSOM-VIEW]]] only for {{PointerEvent}} MUST convert the various coordinate properties for the <code>click</code>, <code>auxclick</code>, and <code>contextmenu</code>
to <code>long</code> values (as defined in the original [[[UIEVENTS]]]) using <a data-cite="ECMASCRIPT#sec-math.floor">Math.floor</a> [[ECMASCRIPT]].</p>
</div>
</section>
</section>
</section>
Expand Down