Skip to content
This repository was archived by the owner on Mar 19, 2018. It is now read-only.
This repository was archived by the owner on Mar 19, 2018. It is now read-only.

Add library to make touch listeners passive by default #38

@RByers

Description

@RByers

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions