-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After a touchend event, some browsers may fire synthetic mouse events (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause any default action (such as scrolling). This is done to simulate the behavior of a mouse for applications that do not support touch events. This is a problem because it results in the JS code reporting duplicated pointer events to Rive: - Confirmed fix Chrome desktop (device simulation) - Confirmed fix on iOS Safari (real device) This PR introduces a solution to keep track of the previous event and to not send the synthetic mouse events if the touch event was a click (touchstart -> touchend). This is only needed when `isTouchScrollEnabled` is false. When true, `preventDefault()` is called which prevents this behaviour. Not helpful for the solution, but for context: - https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers - https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma Reported on Jira: https://rive.atlassian.net/browse/RIV-4845 Fixed solution (with logs): https://github.com/user-attachments/assets/83a77c64-24b4-4381-8e97-178dfbcabc1d Diffs= bc9aab464 fix: synthetic browser events (#7609) Co-authored-by: Gordon <[email protected]>
- Loading branch information
1 parent
1389579
commit 8136940
Showing
2 changed files
with
52 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
44fae6bfe787063af6cb7390fd83f5de167e79e0 | ||
bc9aab464e494a9ccf1e9e899ac853aa5e5614ef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters