-
Notifications
You must be signed in to change notification settings - Fork 110
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
Allow user-specified click rejection #25
Conversation
@s0meone Any chance of merging this soon? |
What's the status on this? This is really helpful. |
For cross-reference, this fixes #15 (which was closed but never fixed) |
@s0meone Don't mean to be a pain, but we'd really like this merged. It's a non-breaking change. |
Sorry for the delay, I'm currently not working on any React related projects, but I've made some time today, so I can look into this. |
@@ -0,0 +1,5 @@ | |||
module.exports = function(lastTouchEvent, clickTimestamp) { | |||
if (lastTouchEvent && (clickTimestamp - lastTouchEvent) < 750) { | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change this to true
to actually ignore the click event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah I recently changed this to work on React 14 and messed up. Should return true so caller can return null.
Looks good, but the default strategy does not work like the current strategy. If you could change that I can merge it. Again, sorry for the delay. |
It needs to return true so the calling function can return null.
Allow user-specified click rejection
Thanks! :) |
@s0meone Thanks for merging 👍 If you're not working on React related projects anymore, are you looking for new maintainers? We use this library at our organisation (@momentumft), and would be prepared to keep it up to date. |
There are occasions where you might want to reject clicks using a
different strategy than just based on time-between-events. This
allows the consumer to supply their own way of deciding whether or
not to trigger the click event.