ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.23k forks source link

Activates :hover state when scrolling #230

Closed msavin closed 10 years ago

msavin commented 10 years ago

If a user is scrolling over the page, and in that process touch an element with a hover state, that state becomes triggered. It's the only piece missing from perfecting this plug in.

Perhaps there should be like a 20-50ms delay before the touch to see if the user is trying to scroll?

screen shot 2014-03-23 at 10 46 35 pm

matthew-andrews commented 10 years ago

We have had quite a few bugs reported with hover states, most notably: https://github.com/ftlabs/fastclick/issues/83.

I think the general advice in the past is avoid :hover - that said I think we would seriously consider a pull request that improves the current state of :hover support in FastClick. (Here's how Modernizr 'detects' hover support)

But I wouldn't want to add a 20-30ms delay in case a developer was using :hover as it would adversely affect those sites that don't use :hover. Also I'm also not sure how I would go about implementing such a delay (in order to synthesise clicks, they need to be triggered from a real touch event).

msavin commented 10 years ago

Thanks for responding. This guy solved that problem, but integrating his solution is not as painless as FastClick. Maybe you can get some insight from his implementation, he explains it visually: https://github.com/cheeaun/tappable

matthew-andrews commented 10 years ago

That looks like an interesting alternative - thanks!