Skip to content

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

Closed
hartzis wants to merge 3 commits into
mainfrom
on-tap-prioritize-touch
Closed

hartzis wants to merge 3 commits into
mainfrom
on-tap-prioritize-touch

Conversation

@hartzis

@hartzis hartzis commented Mar 2, 2021

Copy link
Copy Markdown
Collaborator

Fix for #231.

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

@hartzis

hartzis commented Mar 3, 2021 •

Copy link
Copy Markdown
Collaborator Author

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

hartzis commented Jun 17, 2021

Copy link
Copy Markdown
Collaborator Author

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