Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Default to passive: true on root document touch scroll blocking event listeners #35

Closed

Description

@dtapuska

Chromium/Blink would like to propose an intervention where touch scroll blocking event listeners (touchstart and touchmove) added to Document Level objects would default the AddEventListenerOptions passive field to true.

Document Level objects are defined to be the window, document and body.
Touch scroll blocking event listeners are touchstart and touchmove.

Empirically we have determined that over 80% of touch event listeners invoked don't end up preventing scrolling. There are two opt outs that developers can use:

  1. Using touch-action
  2. Explicitly specifying passive: false

See more details in Document Level Passive Event Listeners Intervention

and #18

Activity

  1. dtapuska commented on Oct 25, 2016

    @dtapuska
    Author

    /cc @teddink, @smaug----, @RByers, @foolip, @BenjaminPoulain

    PTAL as I value feedback from everyone.

  2. smaug---- commented on Oct 25, 2016

    @smaug----

    So how is this different to #18 ?
    or w3c/touch-events#74 ?

  3. dtapuska commented on Oct 26, 2016

    @dtapuska
    Author

    By placing this in the wicg we are hoping that we can solicit feedback from our colleagues at Microsoft and Apple.

    #18 covers more than just this root document intervention it also covers making it by default for everything and making events non-blocking during fling. So this is a concrete implementation of a example used in #18 .

  4. foolip commented on Oct 26, 2016

    @foolip
    Member

    Doing it in this venue makes sense, but showing the changes as a patch in DOM would I think make it easier to review.

  5. RByers commented on Oct 26, 2016

    @RByers
    Member

    Thanks for filing this specific concrete issue Dave. Note that there's also an active intent thread on blink-dev. We'll do the cross-vendor discussion here and bring any conclusions to the intent discussion.

  6. RByers commented on Oct 26, 2016

    @RByers
    Member

    And to be concrete, the precise effect of this change is:

    • During addEventListener
      • If type is touchstart or touchmove, AND
      • If passive option is unspecified, AND
      • If target is window, document, document.documentElement or document.body, THEN
      • set passive to true.
  7. foolip commented on Oct 26, 2016

    @foolip
    Member

    Is that any Window, Document or HTMLBodyElement, or some specific ones?

  8. dtapuska commented on Oct 26, 2016

    @dtapuska
    Author
    1. Any Window
    2. Any Document
    3. Any node that has target.ownerDocument.documentElement == target
    4. Any node that has target.ownerDocument.body == target

    In Blink the code is here.

  9. foolip commented on Oct 26, 2016

    @foolip
    Member

    I guess that's if the target is a Node, and using the "node document". That's unambiguous to me, thanks.

    @smaug----, thoughts on that?

  10. RByers commented on Oct 26, 2016

    @RByers
    Member

    I've filed this WebKit bug in the hopes that we can get some public signal on whether this is something WebKit would ever consider doing.

  11. smaug---- commented on Oct 26, 2016

    @smaug----

    hmm, target.document == target? What does that mean? Or target.document.documentElement == target? Is this only for events dispatched to Window, Document or Body or what?
    I thought this was about listeners on Window, Document or Body.

  12. smaug---- commented on Oct 26, 2016

    @smaug----

    And does this mean any document, or only documents which have .defaultView != null ?
    And any body or only body elements which are in document which has defaultView != null?

  13. dtapuska commented on Oct 26, 2016

    @dtapuska
    Author

    target is instance of EventTarget to which the addEventListener is being called on. It has nothing to do with dispatch target at all.

  14. bzbarsky commented on Oct 26, 2016

    @bzbarsky

    target is instance of EventTarget to which the addEventListener is being called on

    Sure, but what exactly is target.document? That doesn't make any sense.

    I think what you mean is something more like (based on looking at the Blink implementation):

    1. Any Window.
    2. Any Document.
    3. Any node which is the https://dom.spec.whatwg.org/#document-element of its https://dom.spec.whatwg.org/#concept-node-document.
    4. Any node which is the https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2 of its https://dom.spec.whatwg.org/#concept-node-document.
  15. dtapuska commented on Oct 26, 2016

    @dtapuska
    Author

    Yes there was an implicit predicate if target is a node on 2, 3, 4.

  16. 6 remaining items

  17. dtapuska commented on Nov 10, 2016

    @dtapuska
    Author

    @BenjaminPoulain; do you have any feelings on whatwg/dom#365 ?
    @teddink; do you have any feelings on whatwg/dom#365, w3c/touch-events#75 ?

    Olli has promised it's on his todo list; I really value other vendors input in this space.

  18. BenjaminPoulain commented on Nov 10, 2016

    @BenjaminPoulain

    Maybe I missed a merge request but is there a property exposed anywhere to query and/or change the default behavior? Or is it all in w3c/touch-events#75?

    Note that I have not worked in WebCore for a few years. It would be good to contact Beth Dakin for an official position.

  19. RByers commented on Jan 12, 2017

    @RByers
    Member

    Note that this is on track to ship in Chrome 56 - hitting stable in a few weeks.

    Maybe I missed a merge request but is there a property exposed anywhere to query and/or change the default behavior

    Sorry I missed this question. No there's no way to change the default, just override it by specifying {passive:false}.

  20. assigned and unassigned on Feb 21, 2017
  21. foolip commented on May 19, 2021

    @foolip
    Member

    What is the status of getting this behavior into a spec? In whatwg/dom#365 (comment) it was noted that we have tests for this in WPT, but seemingly no spec, so I've renamed the test in web-platform-tests/wpt#29039.

  22. johannhof commented on Jun 16, 2022

    @johannhof
    Member

    (As noted in #72, we intend to archive this repository and are thus triaging and resolving all open issues)

    Standardization of this particular intervention is tracked in whatwg/dom#365 and Domenic added a comment summarizing the latest status. There's some wpt work going on in web-platform-tests/wpt#34464 now and I think we can close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions