Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem #2

Closed
wesly1988 opened this issue Dec 20, 2019 · 1 comment
Closed

Problem #2

wesly1988 opened this issue Dec 20, 2019 · 1 comment

Comments

@wesly1988
Copy link

Hi Chen,

I am getting a strange error.
While using the script on mobile I get the following error in console.

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as
[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as

This is on line 38 and 38 of the handwriting.canvas.js

Love the project by the way!
Great learning resources.

@ChenYuHo
Copy link
Owner

ChenYuHo commented Dec 20, 2019

Hi @wesly1988
Thanks for bringing this up, I actually didn't know this.
After some surveys, I concluded this was not a bug.

Quoting from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md:

Passive event listeners are a new feature in the DOM spec that enables developers to opt-in to better scroll performance by eliminating the need for scrolling to block on touch and wheel event listeners.

The warning you saw is suggesting to mark the touchstart and touchmove event handlers as passive to make the page more responsive.

Developers can annotate touch and wheel listeners with {passive: true} to indicate that they will never invoke preventDefault

However, in our case, we do invoke preventDefault because we want to capture the trace and draw it on the canvas instead of invoking the default behavior (scroll).

I'm closing this issue since it's not an error, but feel free to reopen if you see other issues.

@ChenYuHo ChenYuHo pinned this issue Jan 5, 2020
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

No branches or pull requests

2 participants