jquery-archive / PEP

Pointer Events Polyfill: a unified event system for the web platform
https://www.w3.org/TR/pointerevents/
Other
1.67k stars 160 forks source link

Not same behaviours between desktop and mobile #362

Closed ystreibel closed 6 years ago

ystreibel commented 6 years ago

Hi,

Behaviours should not be the same between desktop and mobile ?

pep_different_behaviours_between_mobile_and_desktop

Moreover, we don't have pointerout when pointerup are not fired on mobile but I'm out before up !?

pointerout_after_pointerup

patrickhlauke commented 6 years ago

both gifs are extremely small, so not really easy to see what's going on.

for your first issue: are you actually simulating a tap and then swiping along on that phone emulation? what i'm presuming is the Chrome DevTools device emulation emulates a touchscreen, not a mouse, so it won't react to over/out.

for the second...not quite sure what you mean, and can't quite see if from that small gif at all...

ystreibel commented 6 years ago

For first issue: I'm not simulate a tap and then swiping! But I need to understand, if PEP it's polyfill why it's not the same behaviour between desktop and mobile ?

For the second, I have not a Pointerout between two Pointermove when swiping. I only have the Pointerout after Pointerup:

pointerout_after_pointerup_bis

patrickhlauke commented 6 years ago

For first issue: I'm not simulate a tap and then swiping! But I need to understand, if PEP it's polyfill why it's not the same behaviour between desktop and mobile ?

there's two issues there. you're using the devtools emulator. when you move your mouse over the page in the emulator, the emulation doesn't fire any events to the page. so of course you won't get any pointer events simulated either.

and on a real touchscreen device, there's no concept of "hovering" of course. (if you use an Android mobile/tablet with an actual paired mouse, you also get a mouse cursor on screen...and then you'll get the same behavior as on desktop).

for the second issue, note that PEP has some limitations on devices that only have touch events (like iOS) in how closely it can match the pointer events sequence. which is why you're likely not seeing the pointerout when you're expecting it. but on a more meta level: if you're testing in Chrome...Chrome does support pointer events natively, so you're not seeing the emulated events that PEP is generating, but rather Chrome's own pointer events implementation.

ystreibel commented 6 years ago

Thanks for explaination!

For the second issue, it's work as expected on firefox!

works_fine_in_firefox

Sure it's Chrome polyfill that doesn't return events sequence as expected! So in my case I due to implement a workaround for Chrome when my tap is out of my element during a move, I dispatch an PointerOut event!

patrickhlauke commented 6 years ago

Chrome is running native pointer events, so the PEP polyfill is not doing anything in Chrome.

ystreibel commented 6 years ago

Could I force to use PEP instead of Chrome browser polyfill ?

patrickhlauke commented 6 years ago

No. the point of a polyfill is to fill the gap between a particular new API and browsers which don't support it yet.

Suggest you make sure your code works first and foremost with browsers that support native pointer events, and then work on making sure the code also works correctly when it's polyfilled via PEP.

patrickhlauke commented 6 years ago

Additionally, I'd be careful not to trust mobile emulators too much for this sort of thing. Always test on real device, and refer back to what the expected behavior should be based on the PE spec itself (and file issues related to PEP not following the spec'd behavior separately). Closing this for now if that's ok.