-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Chrome Warning: Added non-passive event listener to a scroll-blocking 'touchstart' event... #260
Comments
I'm also seeing this and it does seem to affect the usability. Dragging around elements is laggy. |
I am seeing this as well and it is actually causing the canvas not to be rendered with position: absolute in |
This appears to result in a bug because of this particular outcome of it not even rendering. |
I'm not sure if my Chrome browser just got updated, but I'm now on version 73.0.3683.103 and I'm suddenly getting these warnings too, originating in both Stage.js and ol.js. "[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952" "[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952" They both repeat three times, warning about 'touchstart', 'mousewheel', 'touchmove' and 'wheel' events. I also found this, which seems similar: dimsemenov/PhotoSwipe#1478 konva 3.2.3 |
I'm also seeing the same warnings as @blueberryfan with
|
Still a thing on the latest versions of everything :
|
At the current moment, I don't see any possible ways to use passive event listeners. We can't use that function in passive events (that is the main idea of passive events - they don't block scrolling). So, for now, we can only ignore that warning. |
Sure, but is there a way to use For instance, I have a canvas which is on a scrolling page on mobile, and I just use click events inside the canvas (not the dragging). When I start scrolling from the canvas the page doesn't scroll. I want it to scroll. Is there any other way to enable this other than disabling the touch events altogether with (Also I'm using |
The solution is to use |
I would like to disagree with the last comment by @lavrton. To get rid of the warning, the code should decide and specify whether the attached event handler will issue a call to preventDefault() or not. Both may be valid use cases.
To optimize scrolling performance, passive event listeners can be declared with an option. Currently, the declaration is missing, and a warning is displayed in recent Google Chrome browsers. To get rid of the warning, the appropriate value for the option should be chosen when the event listener is added. Example (from https://github.com/slipmatio/control-knob/blob/main/src/ControlKnob.vue#L278)
Note: I have raised this issue downstream in peaks.js, but by the suggestion of @chrisn, I am raising it here directly. |
Wow, I didn't know passing an option will remove the warning. Who can make a Pull Request to fix that? Just need to add |
@suterma thanks for the information. |
I can second the large amount of lag. It can take up to a second for the dragging to update. It currently makes my project unusable. Edit: Ok it seems I only get the lag some of the time? It seems random. |
@GameDungeon make a small demo. It should not be related to the passive listeners. Probably you just need to optimize performance. |
Warning message:
Offending code:
konva/src/Stage.js
Lines 59 to 67 in c851b19
Summary of passive event listeners: https://stackoverflow.com/questions/39152877/consider-marking-event-handler-as-passive-to-make-the-page-more-responsive
The text was updated successfully, but these errors were encountered: