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

only fire onTap once for touchend when tracking mouse and touch #234

Closed
wants to merge 3 commits into from

Conversation

hartzis
Copy link
Collaborator

@hartzis hartzis commented Mar 2, 2021

Fix for #231.

Only fire onTap once for touchend event when both trackMouse and trackTouch are true.

@hartzis
Copy link
Collaborator Author

hartzis commented Mar 3, 2021

When i went to sleep last night i realized this initial solution would break mouseup when the user "just clicks" with a mouse.

I took another look at all the amazing examples over at patrickhlauke/touch and stumbled upon his solution for this very issue:

It looks like we can call event.preventDefault() on the touchend when both trackTouch and trackMouse are true.

Example - https://codesandbox.io/s/ecstatic-hawking-556qn
prev3

Updating this PR now, but i dont think there is any real way to test this with @testing-library/react, but i can get an alpha version published and we can use the codesandbox from #231 to test.

@hartzis hartzis linked an issue Mar 3, 2021 that may be closed by this pull request
@hartzis
Copy link
Collaborator Author

hartzis commented Jun 17, 2021

Closing in favor of users implementing fix via this solution - #231 (comment)

@hartzis hartzis closed this Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Touch tap results in mouse events
1 participant