Closed wangf1978 closed 9 months ago
If you're referring to https://chromestatus.com/feature/5093566007214080 it sounds like it only applies when touchstart is added to the document, not when its added to a div. I've been trying to come up with a reproduction with a vue div that will trigger that warning, but haven't been able to. Do you have a reproduction e.g. sfc.vuejs.org ? Here's what I tried:
When I add touchstart
to the document, .cancelable
is false (meaning it's passive). But touchstart
on the div has .cancelable
true (meaning it's active)
I can reproduce the warning with the above playground link:
What problem does this feature solve?
In modern browsers, for some events, for example, wheel, touchstart and so on, if you want to add event listener to it, passive option with true or false need to be specified explicitly, otherwise browser will report some warnings like as:
In some scenario, this default behavior has to be prevented like as using the below code
but there is no way to specify passive: false to vue runtime-dom https://github.com/vuejs/core/tree/main/packages/runtime-dom/src/modules)/events.ts
tons of warnings will be reported by the latest chrome and edge console
What does the proposed API look like?
https://github.com/vuejs/core/tree/main/packages/runtime-dom/src/modules)/events.ts