-
Notifications
You must be signed in to change notification settings - Fork 159
releasePointerCapture firing InvalidPointerId when it shouldn't? #275
Comments
Actually, embarassingly enough I think I just gave the answer as to why this is happening myself...I'm assuming by the time the handler for |
I assumed that was the behavior as well, but was going to check against the spec to see if we already have wording about the use of |
The spec draft at W3C says "iImmediately after firing the pointerup or pointercancel events, a user agent must run the steps as if the releasePointerCapture() method has been called with an argument equal to the pointerId property of the pointerup or pointercancel event just dispatched." https://w3c.github.io/pointerevents/#implicit-release-of-pointer-capture And about releasePointerCapture(): "if the pointerId provided as the method's argument does not match any of the active pointers and these steps are not being invoked as a result of the implicit release of pointer capture, then throw a DOMException with the name InvalidPointerId." So from what I can see, an exception should not be thrown in this case. |
In capture.js this is ensured by calling r = function releasePointerCapture(pointerId) {
assertDown(pointerId);
dispatcher.releaseCapture(pointerId, this);
}; The spec says of an active pointer:
So a mouse pointer should probably still be considered "active" after the button is released. But in mouse.js, It seems to me that |
@thenickdude sounds correct to me. The spec actually directly mentions mouse input, so all good from that front.
Currently This looks like it would resolve the initial issue by @patrickhlauke for mouse pointer which are always active. The timing issue would still exist for touch pointers, since touch pointers are only active while there is a touch contact. |
The other thing we need to handle is calling |
Not sure if it's my (admittedly horrible) code, but: see https://jsfiddle.net/dbjvwcz1/ in Edge and then in, say, Chrome. despite
e.pointerId
being correct (the same as whensetPointerCapture
was called),releasePointerCapture
throwsUncaught Error: InvalidPointerId
(I see that simply omitting the
releasePointerCapture
in my hacky code actually makes it work just fine, and is ok as per spec since the UA should automatically release any captured pointers anyway onpointerup
/pointercancel
... but still, this does seem to point to some issue in thereleasePointerCapture
code)The text was updated successfully, but these errors were encountered: