Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses Passive Event Listeners to Improve Scrolling Performance #350

Open
zwantE opened this issue Jan 16, 2019 · 4 comments
Open

Uses Passive Event Listeners to Improve Scrolling Performance #350

zwantE opened this issue Jan 16, 2019 · 4 comments

Comments

@zwantE
Copy link

zwantE commented Jan 16, 2019

Google Chrome Audits returns an Error:
"Uses Passive Event Listeners to Improve Scrolling Performance"

More Information -> https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners

@YenHub
Copy link

YenHub commented Aug 6, 2019

I have found also that this leads to console errors as such:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/6662647093133312

Scrolling performance, using this plugin on desktop devices, is laggy and leaves the UI feeling at times unresponsive and glitchy as the scroll fights the wheel steps down the page.

Commenting out the following function improves scrolling performance and dramatically smooths out the scrolling:-

function wheel(event) {
    if (!initDone) {
        init();
    }
	// This is the problematic section of code
    // var target = event.target;
    // var overflowing = overflowingAncestor(target);
    // if (!overflowing || event.defaultPrevented || isNodeName(activeElement, "embed") || (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) {
    //     return true;
    // }
    // var deltaX = event.wheelDeltaX || 0;
    // var deltaY = event.wheelDeltaY || 0;
    // if (!deltaX && !deltaY) {
    //     deltaY = event.wheelDelta || 0;
    // }
    // if (!options.touchpadSupport && isTouchpad(deltaY)) {
    //     return true;
    // }
    // if (Math.abs(deltaX) > 1.2) {
    //     deltaX *= options.stepSize / 120;
    // }
    // if (Math.abs(deltaY) > 1.2) {
    //     deltaY *= options.stepSize / 120;
    // }
    // scrollArray(overflowing, -deltaX, -deltaY);
    //event.preventDefault();
    }

I am unsure at this stage what effect this will have on mobile devices scrolling abilities.

I may opt to implement a device type test before allowing this particular section of code to run, therefore reclaiming scroll performance on Desktop whilst preserving functionality on touch devices.

@rsmith4321
Copy link

I've noticed this is still an issue. Will this be fixed in a future version? Thanks!

@mattbryson
Copy link
Owner

mattbryson commented Mar 26, 2021 via email

@holoduke
Copy link

Is this issue fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants