pointerenter and pointerleave doesn't work with touch
Reported by
satef...@gmail.com,
Mar 8 2017
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 Steps to reproduce the problem: 1. Open the attached html file in a chromium 55+, with a touch device (simulated is ok as well) 2. Open the devtools on console tab 3. Place your finger in the blue rect 4. Drag your finger in the red rect 5. Drag your finger back to the blue rect What is the expected behavior? The console should print "enter" when entering the red rect, and print "leave" when leaving the red rect. What went wrong? The console won't print anything. No "enter" nor "leave". The pointerevents pointerenter and pointerleave with touch do not work as intended. Did this work before? No Does this work in other browsers? N/A Chrome version: 56.0.2924.87 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Polyfills like https://github.com/jquery/PEP implement pointerenter and pointerleave correctly, but now with chromium 55 the pointerevents are native, and no polyfill applys anymore. That leads to a broken pointerenter and pointerleave implementation for touch. So this leads to broken webapp behaviour applications on touch devices.
,
Mar 8 2017
The problem is not limited to pointerenter and pointerleave, but pointerout looks broken as well.
,
Mar 8 2017
And another problem with pointerleave/pointerout and touch: Steps to reproduce 1. Open the attached html file in a chromium 55+, with a touch device (simulated is ok as well) 2. Open the devtools on console tab 3. Place your finger in the red rect (prints enter) 4. Move your finger ~1 millimeter inside the red rect, but do not leave it (prints leave, even though the finger didn't leave the rect) What is the expected behaviour? The console should not print "leave", because the finger never left the red rect. What went wrong? The console prints "leave", even though the finger didn't leave the red rect.
,
Mar 8 2017
nzolghadr@ can you please investigate?
,
Mar 8 2017
I presume this is because the adjusting capturing model the specification now follows that PEP hasn't implemented yet. sateffen@ you likely need to call releaseCapture(...) on the pointer id.
,
Mar 8 2017
sateffen@ there are a few problems with your sample. First of all if you don't want the browser to consider the finger movements as any sort of gesture you need to make sure you add the touch-action attribute to the css property. For example "touch-action: none" would disable all gesture detections. Note that if you don't have this property browser may detect a scroll gesture (when you move your finger) and send a pointercancel and pointerleave as the result rightaway. Now assuming you added this attribute we get to the other problem. As Dave mentioned there is an implicit capture for a touch pointerevents in place right now as per spec. To explain a little more, the capture APIs for the pointerevents cause this. So if an element has the capture if you move your finger around and particularly in and out of the elements no boundary events are fired. Basically for example for touch pointer events we setPointerCapture right after pointerdown and before js handler for pointerdown is called. You can observe this behavior by logging gotpointercapture and lostpointercapture events. To disable this functionality you need to have a pointerdown handler and call releasePointerCapture right at the beginning and you will get the same behavior as you wanted. Something like this: https://jsbin.com/nezehuk/edit?html,output I add Scott here in case he wants to add anything regarding jQuery polyfill.
,
Mar 8 2017
,
Mar 8 2017
Ok, now I actually get, what's the problem. I forgot the touch-action, you totally got me there. You're right, without touch-action:none the browser can't determine, whether the user wants to use a gesture or not. Thank you for the hint. The implicit capture was unexpected. However, now I know about that and I understand it. Thank you for your detailed explanation, that helped me a lot. |
||||
►
Sign in to add a comment |
||||
Comment 1 by satef...@gmail.com
, Mar 8 2017757 bytes
757 bytes View Download