lighthouse perf recommendation: use passive touchstart listeners

p.pischel's Avatar

p.pischel

13 Apr, 2017 02:18 PM

running https://github.com/GoogleChrome/lighthouse on our website which uses royal-slider leads to a warning
"Consider marking your touch and wheel event listeners as passive to improve your page's scroll performance"

more details see https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners
and also https://developers.google.com/web/updates/2016/06/passive-event-listeners for a technical background why one should passivate scroll listeners.

what do you think about using a passive "touchstart" listener for rscontainer in royal slider?

  1. Support Staff 1 Posted by Dmitry Semenov on 13 Apr, 2017 02:54 PM

    Dmitry Semenov's Avatar

    Hello,

    For now jQuery doesn't support passive event listeners https://github.com/jquery/jquery/issues/2871 and using vanilla JS addEventListener isn't an option, as the plugin still supports old browsers like IE8.

    Besides that, mobile Chrome already treats "touchstart" as passive by default.

  2. 2 Posted by p.pischel on 18 Apr, 2017 07:03 AM

    p.pischel's Avatar

    do you have a policy how long you are willing to support browser versions like oldIE?
    (or alternatively: do you plan to provide a version of this lib which does not support those old browsers and doesnt require jQuery?)

    file-size is the biggest downside of this library for us.

  3. Support Staff 3 Posted by Dmitry Semenov on 18 Apr, 2017 11:51 AM

    Dmitry Semenov's Avatar

    Yes, there are plans on making pure vanilla js version, but the size of a script won't be significantly reduced after that. The logic of handling Mouse, Touch and Pointer events requires quite a large chunk of code.

  4. 4 Posted by p.pischel on 18 Apr, 2017 12:15 PM

    p.pischel's Avatar

    the safe in code-size would result from the fact that we no longer need to inlcude jquery ;-).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac