Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double ripple on touch devices with delegated click #78

Closed
hoxxep opened this issue Jan 9, 2015 · 4 comments
Closed

Double ripple on touch devices with delegated click #78

hoxxep opened this issue Jan 9, 2015 · 4 comments
Labels

Comments

@hoxxep
Copy link
Contributor

hoxxep commented Jan 9, 2015

Clicking a button or notification on Snarl while using an iOS device (or simulator?) will produce one ripple on the touch event, and then one ripple on the delayed mouseup/click event, meaning it double-ripples with a 300ms delay.

This doesn't happen with Waves v0.5.5, so I'll see why it's happening with the delegated click handler and how to stop it. (Disabling mouse or ripple events after the first touch for the following 500ms would probably fix it? But I'll see if there's a cleaner way.)

I reckon using fastclick.js would also solve it and make pages/buttons feel faster on mobile, but I'll investigate the Waves code first.

@fians
Copy link
Owner

fians commented Jan 10, 2015

Sorry, I think I forgot to mention you before that I have this problem earlier #44, and then I solved it by adding exclusion using if statement.

if (touch) {
   // attach touch event
} else {
   // attach click event
}

@hoxxep
Copy link
Contributor Author

hoxxep commented Jan 10, 2015

The problem is that some touch screen windows laptops will also have a mouse, so if we don't bind the mouse up event then mouse clicks won't initiate waves on those devices? We'll probably need a way of temporarily disabling waves for mouseup events if a touch event has occurred in the last 500ms or so.

@fians fians added the Bug label Jan 10, 2015
fians pushed a commit that referenced this issue Jan 10, 2015
By disabling waves effect temporary for 175ms
@fians
Copy link
Owner

fians commented Jan 10, 2015

It seems if the double ripple problem disappear if I disable event temporary.

@hoxxep
Copy link
Contributor Author

hoxxep commented Jan 10, 2015

Fixed this issue by adding a TouchHandler which stacks clicks and disables mousedown for 500ms when a touchstart event occurs (doesn't affect the listeners so there's no performance loss with adding/removing listeners). On the train right now so I don't have Internet on the laptop, but I'll push the change later tonight :)

hoxxep added a commit to hoxxep/Waves that referenced this issue Jan 10, 2015
hoxxep added a commit to hoxxep/Waves that referenced this issue Jan 11, 2015
fians pushed a commit that referenced this issue Jan 11, 2015
(v0.6.0-dev) Fix issue #78: prevent double ripple on touch
@fians fians closed this as completed Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants