Click event's preventDefault not being called properly in Edge on touch-capable laptop
See original GitHub issueExpected Behavior
Dragging (via mouse) within Pixi canvas has no effect.
Current Behavior
Dragging withing Pixi canvas causes the whole canvas to be dragged as a static image (presumably normal canvas dragging behavior in edge?)
Possible Solution
My guess is that there’s some timing issue or state issue that is preventing Pixi’s interaction manager from eating the mouse events properly. Am digging into the source code to try and find what might be wrong.
Steps to Reproduce
Load example below, drag on any part of the game scene repeatedly. After a few tries, you should see a screen snippet dragging with your cursor.
Environment
pixi.js
version: 5.2.0- Browser & Version: Edge 44.18362.449.0
- OS & Version: Windows 10 - latest
- Running Example: https://app.lexercise.com/mylexercise/index/index/demo/k2l4hfh4b1fhx8xt
I’ve tried using the InteractionEvent#stopPropagation method, but it has no effect on this problem. Seems to be a low-level issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Click event's preventDefault not being called properly in Edge ...
My guess is that there's some timing issue or state issue that is preventing Pixi's interaction manager from eating the mouse events properly....
Read more >IE & Edge, preventDefault() not working on laptop with touch ...
I have following element: <a id="buttonNext" href="somepage"> </a>. and following javascript: $(document).on('click', "#buttonNext", ...
Read more >Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >How to correctly use preventDefault(), stopPropagation(), or ...
Now we see that not only does the click event not bubble up the DOM, but by removing the preventDefault method call the...
Read more >PreventDefault() doesn't work in Internet Explorer 11 or ...
Fixes an issue in which the preventDefault method doesn't work for event.keyCode when IME is enabled in Internet Explorer 11 or Microsoft Edge....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, got it:
That did it. I simply removed the check for isNormalized, and that seems to have fixed the problem. Seems like an easy fix overall - I can’t see the harm in preventing default handling for events that aren’t normalized. Hard to believe that’s a performance optimization, but I’m sure there is some reason for that check.
Regardless, thanks again Ivan for being the most responsive and helpful open source developer I know.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.