How to scroll without accidently clicking list items?

@adam I’m pretty sure what he is talking about is the issue with the TOUCH_TOLERANCE_X and TOUCH_TOLERANCE_Y and it is device specific not android version. I actually loaded the latest on mine and noticed the same issues I was having before are happening again. Meaning sometimes I have to click a few times for it to register. You changed it from 15 to 2 and then back to 15 (where it worked for me) and then changed it again so the x tolerance is 4 and the y tolerance at 2. I just don’t think with some devices that is enough tolerance so it is counted as a scroll instead of a click. I’ll mess around with it on my device until I don’t see it happening anymore.

It seems like for my device (S3 with 4.4) all the clicks are registered when both TOUCH_TOLERANCE_X and TOUCH_TOLERANCE_Y are at 6. However, not saying that is where you should put them. Just a data point.

Yeah finding this magic number is difficult. The reason it’s so small is because its also easy to trigger a click if you’re scrolling really fast, like really short flicks.

I’ll updated it to so the Y tolerance is 6px like @jazzfanatic suggested, but I also made some changes to how the item activation works (displaying an item as being “active”). Yes the clicks were not happening always as expected and this commit should improve it, but also the visual activation prematurely looked like the item should not have been clickable. (Sorry, hard to explain).

Previously I disabled the activation class immediately on a touchmove, where as the click will still fire off if the touchstart and touchend were within a few pixels of each other. So visually it may have looked like the click shouldn’t have worked. I just updated it so the use the same logic.

For example, if you hold down an item and move just 5 pixels, the item will stay active (before it wouldn’t have), and the click will fire. But also, if you hold down an item, and move a larger distance, once it realizes that it went farther than 6 pixels it’ll not allow a click to happen, AND it’ll not show the item as being active.

Lastly, this is all different for mouseevents which is largely because of how Android fires off both touch and mouse events. For a mouse pointer, you can click and hold an item, move more than 6px and release and it’ll still fire off the click. The difference here is that mousedown and mousemove is not the natural way to scroll a webpage with a mouse, unlike touchstart and touchend.

Please test it out on your devices, build 1554 or later, and please let me know any issues you may have found:
http://code.ionicframework.com/#nightly

Also, thank you everyone for bring up these issues and helping to debug this, thanks again!

1 Like

You rock, it is a very tough problem to cover all scenarios.

Thank you for the great work @adam. Just recompiled my app and the response on the android 4.1.2 device has improved greatly. I’m on nightly 1562 or so, I can confirm the current settings appear appropriate for most devices. Would continue to test and provide useful feedback, though I’d probably stay on this build, launch my app and update when the next stable version is released.
Again, thank you guys for this sweet framework.