Closed Psycarlo closed 1 year ago
What if we changed events from passive: false
to passive: true
?
@Norserium
@Psycarlo, thank you for your notice. I need to investigate this aspect. I will try to do it on weekends.
Nice! Let me know if you want to make the change. If so, I can create the PR
@Psycarlo, how to reproduce the appearing of this warning?
@Norserium
Create a new vue app: npm init vue@latest
Install vue-advanced-cropper v2.8.8
Add Cropper
<Cropper ref="cropper" src="https://images.unsplash.com/photo-1516007445015-fc20d86f8468?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80" :stencil-component="RectangleStencil" />
Run dev server
Open console
[Violation] Added non-passive event listener to a scroll-blocking <algum> evento. Consider marking event handler as 'passive' to make the page more responsive. See <URL>
@Psycarlo , thank you, I reproduced the appearing of this warning.
But there is the reason, why this event listeners are marked as not passive. They should be prevented. The most clear example is the preventing of the mobile pinch gesture to implement the image zoom, otherwise they will conflict.
Of course, I can use touch-action: none
, but its support is limited.
Any ideas? Did you see any solid cropper that uses passive events?
I did not.
Maybe could we have an option to turn on/off touch-action
?
Or I will just keep living my life looking at the warning 😄 -- and that is fine
@Psycarlo, try to open Google Maps and look in the console window. I assume it's the common practice and it's okay.
Getting this warning:
[Violation] Added non-passive event listener to a scroll-blocking <algum> evento. Consider marking event handler as 'passive' to make the page more responsive. See <URL>
Versions: "vue": "^3.2.16" "vue-advanced-cropper": "^2.8.8" "vite": "^4.0.1"