stuyam / pressure

:point_down::boom: JavaScript library for handling Force Touch, 3D Touch, and Pointer Pressure.
https://pressurejs.com
MIT License
2.91k stars 98 forks source link

Chrome Android and OSX device emulation mode register touches as deep/force press #15

Closed kylehalleman closed 8 years ago

kylehalleman commented 8 years ago

Steps to reproduce:

Open pressurejs.com in Chrome on OSX and in DevTools turn on device emulation and set it to iPhone 6. Scroll to bottom and tap on test 5 and the pop up that should only trigger with a force touch displays.

Same results on Chrome Android using a Samsung Galaxy S4 and Nexus 5. On Nexus 5 all the tests get triggered.

stuyam commented 8 years ago

@kylehalleman thanks for this, I can confirm that this does happen in the device emulator in Chrome. Ill have to dig into this!

stuyam commented 8 years ago

@kylehalleman I appreciate all of the feedback and testing you have done so far with Pressure! Are you planning on using Pressure for an upcoming project? Just curious about your interest in Pressure :smiley:

kylehalleman commented 8 years ago

@yamartino I've been interested in adding 3D touch to a web app I'm working on at my day job, just playing around with some ideas. I tried using variations of this code but it never seemed to work right, so I gave up. That's where I first ran into this Chrome bug.

But then I heard about this project on 5 Minutes of JavaScript podcast, so I've been playing around with it.

If I can find a solution to the Chrome bug I'll send a pull request, but in the past when using that other code, I found nothing online about the problem.

Keep up the good work.

stuyam commented 8 years ago

@kylehalleman thanks for the feedback! I can confirm that all of the devices you mentioned trigger false results when using the Chrome emulator. However for example running Chrome on my actual iPhone 6, it does not trigger those results. It seems like that specifically is only a emulator issue.

Also the chrome emulator running Samsung Galaxy S4 and Nexus 5 do get the same false results. However are you getting those false results in the Chrome emulator on OSX or is that happening on the physical Android devices themselves?

kylehalleman commented 8 years ago

@yamartino They're actual devices. I only had deep press set, and pretty much every tap (or swipe even) triggered the deep press.

kylehalleman commented 8 years ago

@yamartino I found this repo that seems to mention the odd Chrome behavior. Check out this section of the code and also here.

stuyam commented 8 years ago

@kylehalleman I think I fixed the bug in the "dev-v0.0.4" branch. Here is the commit that fixed it: https://github.com/yamartino/pressure/commit/05c290856b6902feab4d6651256d4cc5663b0109

I would love if you could try the development version and see if that fixes it! Thanks for all of the help @kylehalleman

If it works for you I will close the issue :smile: