JedWatson / react-tappable

Tappable component for React
http://jedwatson.github.io/react-tappable/
MIT License
863 stars 90 forks source link

onTap should not be triggered when tap occurs to stop momentum scrolling #55

Open slorber opened 9 years ago

slorber commented 9 years ago

When an user is scrolling on a mobile there's "momentum scrolling" effect that makes the content continue to scroll even after the touchend event, according to the movement velocity (also called "fling scroll")

Often, the user may want to stop that momentum scrolling by tapping the screen. He does not care what he taps on, he just want to stop scrolling. But unfortunatly when the scrollable content has a lot of onTap listeners, the probability to trigger one of them is high and the user ends up opening unintentionally new popups / menus / content...

Other references on this issue here: http://stackoverflow.com/questions/27040241/detect-if-a-touchstart-touchend-has-cancelled-a-scroll-momentum-scroll http://stackoverflow.com/questions/10573080/mobile-safari-vertical-scrolling-how-to-detect-when-the-window-has-stopped-mov

It seems a workaroud has been implemented for FastClick#42 and the commit is here: https://github.com/ftlabs/fastclick/commit/2a31072ca469def511f7ddbedbcaf305d37ab934

I may have time to work on this as we need it at at work some point, just tell me if you agree with the idea

dcousens commented 7 years ago

PRs welcome...