WICG / EventListenerOptions

An extension to the DOM event pattern to allow authors to disable support for preventDefault
Other
1.17k stars 140 forks source link

Add library to make touch listeners passive by default #38

Open RByers opened 8 years ago

RByers commented 8 years ago

Thinking about how to make it easier to get the perf benefits of passive touch listeners, I'm thinking it would be helpful to publish a sample library which makes all touch listeners passive by default unless requested otherwise.

In particular, we could hook addEventListener and set the passive option automatically for touchstart or touchmove unless the target element has a blocksScroll class applied to it or something.

I'm sure there would be scenarios where naive usage of this causes some subtle breakage (eg. carousels that pan without disabling scrolling) but it would probably be pretty minor in practice often easily addressed by the application of touch-action. Such issues are probably better than the alternative of such sites just having scroll jank issues, and likely even better than those sites getting impacted by our intervention (WICG/interventions#18).

Thoughts?