question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Click event's preventDefault not being called properly in Edge on touch-capable laptop

See original GitHub issue

Expected 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

I’ve tried using the InteractionEvent#stopPropagation method, but it has no effect on this problem. Seems to be a low-level issue.

drag-bug

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
irongazecommented, Dec 18, 2019

Ah, got it:

PIXI.interaction.InteractionManager.prototype.onPointerDown = …my patched function…

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.

0reactions
stale[bot]commented, Mar 17, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found