magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.32k forks source link

Does not use passive listeners to improve scrolling performance #34158

Open ia-gaurav opened 3 years ago

ia-gaurav commented 3 years ago

Preconditions :

Magento 2.4 latest version

Steps 1: Check you site via google page speed :https://developers.google.com/speed/pagespeed/insights Steps 2: Check audit report you will see below issues Does not use passive listeners to improve scrolling performance Consider marking your touch and wheel event listeners as passive to improve your page's scroll performance. Learn more. Source …en_US/jquery.min.js:313:558

Can it be fixed are it is causing issue with mobile perfomace

m2-assistant[bot] commented 3 years ago

Hi @ia-gaurav. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

mrtuvn commented 3 years ago

the fix maybe take times even a years to deploy/merge into codebase i think you can workarounds and patch with your own way https://stackoverflow.com/questions/60357083/does-not-use-passive-listeners-to-improve-scrolling-performance-lighthouse-repo Add web/jquery.js to your theme instead modify core. Add some patch at bottom

Quazz commented 3 years ago

Personally I've been using the following patch on jquery for ages:

require(['jquery'], function(jQuery) {
    'use strict';
    (function() {
        jQuery.event.special.touchstart = {
            setup: function(_, ns, handle) {
                this.addEventListener('touchstart', handle, {passive: ns.includes('noPreventDefault') ? true : false});
            }
        };
        jQuery.event.special.touchmove = {
            setup: function(_, ns, handle) {
                this.addEventListener('touchmove', handle, {passive: ns.includes('noPreventDefault') ? true : false});
            }
        };
    }());
});
mrtuvn commented 3 years ago

Add to the file lib/web/jquery/patches/jquery.js

mrtuvn commented 3 years ago

Created pr for jquery newer version here https://github.com/magento/magento2/pull/34162

@ia-gaurav See my link above

ia-gaurav commented 3 years ago

@mrtuvn - can u tell what to add in lib/web/jquery/patches/jquery.js

nkajic commented 3 years ago

https://gist.github.com/nkajic/727ae5ff874894f96356b44eece9fd6a

m2-assistant[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel, here is your Magento Instance: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering Admin access: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering/admin_b01d Login: ef808a7f Password: 82a61d380e70

engcom-Hotel commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel, here is your Magento Instance: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering Admin access: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering/admin_06e0 Login: b0960393 Password: 87c2fcf1119a

engcom-Hotel commented 3 years ago

Hello @ia-gaurav,

We have checked this issue on the cloud instance, but we are unable to reproduce the issue. The issue you mentioned in the description is not visible on both desktop and mobile reports.

Please let us know if we have missed anything in order to reproduce the issue.

Thanks

mrtuvn commented 3 years ago

Added solution fix in above link in my comment https://github.com/magento/magento2/pull/34162

mrtuvn commented 3 years ago

@engcom-Hotel You may not notice this line passive At categories Performance

engcom-Hotel commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel, here is your Magento Instance: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering Admin access: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-develop.instances.magento-community.engineering/admin_f5b1 Login: 92acc59b Password: ce8ac2d7e586

engcom-Hotel commented 3 years ago

@magento give me 2.4.3 instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Hotel, here is your Magento Instance: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-3.instances.magento-community.engineering Admin access: https://6dd90eea1a8e2a0fc4db3ee65e365b93-2-4-3.instances.magento-community.engineering/admin_39de Login: ba683289 Password: 44f6f42754f1

engcom-Hotel commented 3 years ago

Hello @mrtuvn,

Thanks for the updates!

I was checking the homepage, the issue is not visible there but inner page the issue can be reproducible. Please have a look at to below screenshot: image

@ia-gaurav Since the issue is reproducible, we are confirming this issue.

Thanks

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1541 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 years ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

github-jira-sync-bot commented 3 years ago

:x: You don't have permission to export this issue.

hostep commented 3 years ago

@engcom-Hotel: now that you have confirmed this, could you edit your post with those super large images and remove them? Those large images cause issues in our browsers while scrolling through this issue due to taking up a lot of resources while trying to display them. Much appreciated, thanks!

in-session commented 3 years ago

Of course, you always start from Luma, but I think there will be problems with the adaptation of a shop at the latest. Here is an example from my current dev environment.

image https://stackoverflow.com/a/68489296