Re: [pointerevents] Release Implicit Capture, Capture at Ancestor Element (#327)

> > 1. pointerdown on child
> > 2. child calls hasPointerCapture and determines pointer is captured implicitly (touch)
> > 3. child immediately calls releasePointerCapture
> > 4. pointerdown bubbles to parent
> > 5. Parent calls setPointerCapture
> > 6. Parent processes pointermove events until pointerup, pointercancel, or lostpointercapture
> Actually the events always bubble regarding of the explicit/implicit capturing. So if the child really doesn't care about any event they could just not have a handler. In other words, your code should work even if you remove the first 3 steps. So for the touch case at first implicit capture goes to the child. Then when the event bubbles and parent calls setpointercapture it effectively steals the capture and after that child will not get the event (as it is not in the propagation path anymore).


Just an update, as I'm now trying to figure out a workaround for this Webkit bug. 

Although your suggestion _sounds_ good, and I mentioned I may have to recommend that to users, it doesn't work. Even without handlers on the child element, the result is the same: the parent calls getPointerCapture successfully, a gotpointercapture is fired for the parent, but the parent doesn't actually get the capture (as shown on the test page I posted). The only workaround I found is to set ```pointer-events:none``` on any child elements, which is fine for valid use cases but doesn't apply here.

For what it's worth, there's another issue I've noticed regarding implicit pointer capture. The spec for Implicit Pointer Capture states:

_*Direct manipulation devices should behave exactly as if setPointerCapture was called on the target element just before the invocation of any pointerdown listeners. The hasPointerCapture API may be used (eg. within any pointerdown listener) to determine whether this has occurred. If releasePointerCapture is not called for the pointer before the next pointer event is fired, then a gotpointercapture event will be dispatched to the target (as normal) indicating that capture is active*_

The Webkit issue is it doesn't release an implicitly captured pointer like it should.

But additionally, I haven't found any browsers that actually fire gotpointercapture when an element implicitly gets capture(as the spec quoted above states they should). It's unfortunate, as it forces developers to assume implicit capture for all pointerdown events of type 'touch' (which may be the case in all current implementations. , but the spec only states "Direct manipulation devices _should_ ...", not _must_)...

GitHub Notification of comment by msalsbery
Please view or discuss this issue at using your GitHub account

Sent via github-notify-ml as configured in

Received on Tuesday, 23 March 2021 23:55:54 UTC