tldraw / tldraw

SDK for creating whiteboards and canvas experiences on the web.

Home Page:https://tldraw.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: "Unable to preventDefault inside passive event listener invocation" on every gesture

VarunNSrivastava opened this issue · comments

What happened?

"Unable to preventDefault inside passive event listener invocation" is logged as an error in the console on every gesture.

I discovered this while testing locally but found that it even happens on the main site tldraw.com.

How can we reproduce the bug?

Using a macbook (pro, m1) on chrome, open the console on tldraw.com. Draw anything.
Screenshot 2024-05-02 at 5 20 34 PM

What browsers are you seeing the problem on?

Chrome

Contact Details

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

I'm not seeing this on my side. What version of Chrome are you using? Is this a local room or a multiplayer room? Can you try without browser extensions?

I can reliably reproduce if I choose a device in chrome. The issue seems to be related to onTouchStart listeners that are set to passive by default so you can't prevent default behavior.

I'm not sure why those need default behavior prevented, do you know? I tried it and didn't notice any weird behavior.. but definitely could have just been because I didn't test extensively.

Looks like it's possible to manually add and remove event handlers ourselves though.

Do you prefer one or the other of those solutions?

I am able to repro but only currently on mobile. Happens via useCanvasEvents