You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### What problem does this feature solve?
An event modifier to support passive events was added in #5132.
In the last couple of years, browsers have adopted the passive behavior by default fortouchstartand touchmove events (reference). Thus, to be able to cancel one of these events by calling e.preventDefault(), you need to explicitly pass { passive: false } when adding the event listener.
With the current API this is impossible to achieve in a Vue template (as far as I can tell). You must manually add and remove the event listener in a component hook like so:
### What does the proposed API look like?
An event modifier that does the opposite of the passive event modifier, specifying the option as false instead of true.
Unsure of the naming - perhaps nonPassive, active, assertive, intentional.
In vue/src/core/vdom/helpers/update-listeners.js:22, normalizeEvent always returns an object with a set passive property.
I’m not familiar with Vue’s source code, but does that mean that when the .passive modifier is not present, each event handler is always declared as active? This seems wrong in the light of browser’s changing the default for certain event types to be passive by default (see Improving scrolling performance with passive listeners). If .passive is not present, I don’t expect event handlers to be marked as not passive.
With regards to the feature request itself, I think “active” would be a natural choice here.
### What problem does this feature solve?
An event modifier to support passive events was added in #5132.
In the last couple of years, browsers have adopted the passive behavior by default for
touchstart
andtouchmove
events (reference). Thus, to be able to cancel one of these events by callinge.preventDefault()
, you need to explicitly pass{ passive: false }
when adding the event listener.With the current API this is impossible to achieve in a Vue template (as far as I can tell). You must manually add and remove the event listener in a component hook like so:
### What does the proposed API look like?
An event modifier that does the opposite of the
passive
event modifier, specifying the option asfalse
instead oftrue
.Unsure of the naming - perhaps
nonPassive
,active
,assertive
,intentional
.The text was updated successfully, but these errors were encountered: