Viewing 28 posts - 1 through 28 (of 28 total)
  • Author
    Posts
  • #1426885

    There is a known issue with WP-Rocket and click actions on mobile browsers. The issue with Enfold and WP-Rocket is that the tap on the burger menu is deferred along with all other js files.

    I need help to identify the exact scripts that make the mobile menu work so I can exclude them from being deferred.

    Appreciated.
    El

    #1426912

    Hey El,
    Thinkjarvis shared this thread: The best settings for Enfold and WP-Rocket which you may find helpful.
    But I believe this this thread is what you are looking for: Wp Rocket broke my hamburger menu, tags and accordion
    The issue was the user was using the REMOVE UNUSED CSS option so the solution was to add these classes in the CSS safelist in the Wp Rocket REMOVE UNUSED CSS option:

    
    .main_menu
    .menu-item-avia-special
    .av-hamburger
    .av-hamburger-box
    .av-hamburger-inner
    .av-burger-overlay
    .av-burger-overlay-scroll
    .av-burger-overlay-inner
    .av-active-burger-items
    .av-burger-overlay-active
    .av-burger-overlay-active-delayed
    .av-hamburger--spin
    .av-js-hamburger
    .avia_hidden_link_text
    .av-burger-menu-main
    #av-burger-menu-ul
    #avia-menu
    .av-width-submenu 
    .av-active-burger-items
    .current_page_item 
    .current-menu-item
    .av-active-burger-items
    .avia-menu 
    .av-main-nav-wrap
    .menu
    .av-main-nav
    .av-width-submenu 
    .sub-menu
    .av-burger-overlay-bg
    .inner-container
    #header_main
    

    Best regards,
    Mike

    #1426975

    Appreciated but all this is working fine. The javascript action of the hamburger menu is getting deferred. So I need to know that script triggers the opening tap action. Appreciated!

    #1426977

    Hi,
    Did you try the first link that I posted with the javascript files to exclude?

    /wp-includes/js/jquery/jquery.min.js
    /wp-includes/js/jquery/jquery-migrate.min.js
    /jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js
    /jquery-migrate(.min)?.js
    /dynamic_avia/avia-footer-scripts-(.*).js
    /enfold/js/avia.js
    /enfold/js/shortcodes.js
    /enfold/js/avia-compat.js

    Best regards,
    Mike

    #1426980

    Of course. This is the standard for any Enfold Wp-Rocket user.

    There is a script that is triggered when opening the burger menu. Which one is it?

    Best
    Elmar

    #1426984

    Hi,

    \js\avia-snippet-hamburger-menu.js
    \js\avia-snippet-hamburger-menu.min.js

    are you using the REMOVE UNUSED CSS option in wp-rocket?

    Best regards,
    Mike

    #1427022

    Yes, I do and thank you. Unfortunately the touch event seems to get caught behind delayed actions no matter what I exclude.

    
    #top .dropdown_widget .buttons .button.checkout
    #top .dropdown_widget .buttons .button
    .woocommerce-mini-cart__buttons
    a.button.wc-forward
    a.button.wc-forward:hover
    .woocommerce-page .button
    #sv-rbadge-box
    #searchform
    #searchsubmit
    .avia-search-tooltip
    .inner-toolip
    .minus
    .plus
    .rating_container
    .woocommerce-product-gallery
    .header_color .avia-tt
    #top #searchform(.*)
    .avia-search-tooltip #searchform(.*)
    #top .avia-font-entypo-fontello
    .header_color .av_ajax_search_image
    .header_color .av_ajax_search_title
    .header_color .ajax_search_excerpt
    (.*).av_ajax_search_entry(.*)
    .ajax_search_response (.*)
    (.*).av_ajax_search_title
    (.*).ajax_search_excerpt
    (.*).av_ajax_search_image
    .header_color h4
    (.*).av_ajax_search_content
    .main_menu
    .menu-item-avia-special
    .av-hamburger
    .av-hamburger-box
    .av-hamburger-inner
    .av-burger-overlay
    .av-burger-overlay-scroll
    .av-burger-overlay-inner
    .av-active-burger-items
    .av-burger-overlay-active
    .av-burger-overlay-active-delayed
    .av-hamburger--spin
    .av-js-hamburger
    .avia_hidden_link_text
    .av-burger-menu-main
    #av-burger-menu-ul
    #avia-menu
    .av-width-submenu
    .current_page_item
    .current-menu-item
    .avia-menu
    .av-main-nav-wrap
    .menu
    .av-main-nav
    .sub-menu
    .av-burger-overlay-bg
    .inner-container
    #header_main
    
    
    \/jquery(-migrate)?-?([0-9.]+)?(.min|.slim|.slim.min)?.js(\?(.*))?( |'|"|>)
    /dynamic_avia/avia-footer-scripts-(.*).js
    /enfold/js/avia-snippet-hamburger-menu.min.js
    /enfold/js/avia.js
    /enfold/js/shortcodes.js
    /enfold/js/avia-compat.js
    /enfold/js/(.*).js
    /enfold/js/aviapopup/(.*).js
    /enfold/config-templatebuilder/avia-shortcodes/
    /wp-content/plugins/woocommerce-germanized/(.*)
    var avia_is_mobile
    

    It is a very common problem and I don´t know what the issue is but it seems that the burger-menu calls to some other function that still does get delayed.

    #1427098

    Hi,

    Thank you for the info.

    The avia-hamburger-menu-js script still has the defer attribute when we checked the site. Have you tried using the absolute or full URL in the exclusion?

    <script type="text/javascript" src="https://w2n9d6m2.rocketcdn.me/wp-content/themes/enfold/js/avia-snippet-hamburger-menu.min.js" id="avia-hamburger-menu-js" defer=""></script>
    

    Try to add the following lines in the excluded javascript files field.

    https://w2n9d6m2.rocketcdn.me/wp-content/themes/enfold/js/avia-snippet-hamburger-menu.min.js
    https://aerobis.com/wp-content/themes/enfold/js/avia-snippet-hamburger-menu.min.js
    /wp-content/themes/enfold/js/avia-snippet-hamburger-menu.min.js
    https://w2n9d6m2.rocketcdn.me/wp-content/themes/enfold/js/avia-snippet-hamburger-menu.js
    https://aerobis.com/wp-content/themes/enfold/js/avia-snippet-hamburger-menu.js
    /wp-content/themes/enfold/js/avia-snippet-hamburger-menu.js
    

    Best regards,
    Ismael

    #1427103

    Hi,

    I only put exclusions in the delay entries – my bad. Also added alls AVIA scripts to the do not defer section. It is somehow still happening on mobile. Bizarre.

    Best,
    Elmar

    #1427176

    Hi,
    Strange, I would imagine that the other thread would have lead to the solution as it seemed to be the same situation.When I check your site with the inspector emulating a mobile device and view the scripts loaded and then click the burger menu 20 additional scripts are loaded:
    Enfold_Support_4003.jpeg
    most of which I don’t think apply, such as FB, YT, reputation badge, but a few WordPress core scrips load from /wp-includes/js/ like wp-polyfill.min.js which sometimes is used as a “bridge” between scripts, so perhaps this is part of the issue.
    Try looking at these scripts and see if this helps.
    I also note that if you look at the DOM in the inspector you can see all of the scripts that get the data-rocket-status=”executed” attribute when you click the burger menu, and one that stood out to me was the variables for the avia_framework_globals
    Enfold_Support_4005.jpeg
    I’m not sure how you could allow these variables in wprocket but perhaps this is related.
    I tried to search for other threads with this issue for possible clues, but the only other one I found was the one I linked to and you have already followed those steps.
    Your not using any other plugins like Autoptimize and you tried disabling Enfold Theme Options ▸ Performance ▸ JS & CSS file merging and compression right? It looks like you are using a CDN, perhaps try disabling it for now to ensure that there is on conflict.
    The only other thing that I can think of is to disable all of the wprocket settings so the burger menu is working correctly and then enable one at a time, clearing the cache with the CDN disabled until it breaks again and reviewing it. Or perhaps try adding all of the known js files from WordPress and Enfold until the burger menu works correctly and try removing them one at a time until it breaks and you find the combination that you need.

    Best regards,
    Mike

    #1427209

    Mike,

    super helpful thanks. I excluded several of these items but ultimately no change. In the end I would have to unqueue all js in the call stack that is triggered once the burger-menu is called.

    Call Stack:
    https://drive.google.com/file/d/1fzxCDHkSrVFKDXr0L_6TeOt3kOQkjH2S/view?usp=sharing

    But that seems like the wrong approach. There should be a way within Enfold that the menu takes precedence in the call stack.

    Best,
    Elmar

    #1427214

    Hi,
    I have asked the rest of the team for any advice, and either I or they will reply with further ideas, Thank you for your patience.
    It looks like your CDN is still activate, please disable this for now so we can be sure there are no conflicts and try the other steps above.

    Best regards,
    Mike

    #1427489

    Hi Mike,

    any news on this? The CDN is not the issue. It really is the why that scripts get delayed.

    Best,
    El

    #1427495

    Hi,
    I have not heard any feedback yet. Perhaps if you could create a staging site we could examine closer, if you do please try to disabled the CDN for it, because often when testing the CDN will skew the results so that the cached is not cleared when you think it is. Often it is these little things that turn out to be the issue.
    It seems that this be related to something locally as we are not seeing this issue with other sites, other than the one we linked to above.

    Best regards,
    Mike

    #1427543

    Mike,

    sure thing and done. Thank you for taking care of it.
    Btw – there is also bug report of on Github but this is not limited to Safari: https://github.com/wp-media/wp-rocket/issues/3142

    Best,
    Elmar

    #1427556

    Hi,
    Thanks for the link to the WP Rocket bug report, the “solution” at the bottom leads to a 404 page, and the very last post from Nov 30, says it is not a working solution so perhaps WP Rocket is still working on this?
    Nonetheless I will look at your staging site, please include an admin login in the Private Content area to the staging site so we can examine closer.

    Best regards,
    Mike

    #1427574

    Hi Mike,

    You might need to be logged in to see the report.

    Best

    #1427582

    Hi,
    Thanks for the login, when I test your page above with the Dev Tools inspector for mobile device (425px) and am not logged in I see the delay when clicking the burger menu, but when I am logged in for the same page there is no delay when clicking the burger menu, even when I clear my browser cache with a hard reload.
    I also tested on my real Android device and had the same results.
    Do you also experience this also? Please try.

    Best regards,
    Mike

    #1427601

    Sure, thatbis the usual way. Most caches are disabled for logged in users. You have to test without being logged in. Everything is circumvented otherwise.

    #1427639

    Hi,
    Ok, its solved, please ensure to clear your mobile browser cache, please note that testing with iPads & iPhones can be hard to clear the cache, often you need to also clear the history to fully purge the cache, following these steps for Safari and note Step 4 where you will Clear the History.

    Best regards,
    Mike

    #1427763

    Hi Mike,

    I emptied the cache but the issue seems to persist. What did you change? Just the change in Wp-Rocket? Excluding everything from (?:/wp-content/|/wp-includes/)(.*) is not really an option.

    Best,
    Elmar

    #1427765

    I was hoping for a way to make sure that just scripts required by the burger menu can be identified and excluded rather than removing all other delayed scripts that really are required to be delayed.

    #1427769

    Hi,
    The (?:/wp-content/|/wp-includes/)(.*) was from the WP Rocket documentation, but I have removed it and the burger still opens correctly.
    Please clear your browser cache and check again.

    Best regards,
    Mike

    #1427770

    Hi,

    got it. Tried it and made a video as proof. Doesn´t work sadly.

    Best,
    Elmar

    #1427797

    Hi,
    Well I don’t know what to tell you, it works for me on Android and Windows.
    Perhaps what you are experiencing is related to the bug reported on the wp rocket github for Safari, if that is the case then I don’t think we can help you with it.
    The issue that I was experiencing on Android and Windows turned out to be due to one of your plugins and it’s inline javascript and not any of the theme files. The solution was to add these two lines in your Excluded JavaScript Files field:
    const shopvote_ajaxurl
    shopvote_fetch_reviews

    I can’t tell if the bug report is a wp rocket or Safari issue, but it doesn’t seem to affect Android and we have not had any other reports about this.

    Best regards,
    Mike

    #1427857

    Mike,

    appreciate the help a lot and all good. Yes, it seems to be iOS specific but since this is a large user-base it is concerning. For now it seems we have to live with it but it is pretty bad from a user perspective. Again – appreciate the quick support!

    Best,
    Elmar

    #1427915

    Hi,
    Thanks for the feedback, sorry we were not more help, I read the github bug report again and while some were calling for a fake click event on the page load, other were pointing out that that doesn’t really help because to causes the page to load everything and not have the advantage of the JS delay, so over all turning the JS delay has been the only solution.
    https://github.com/wp-media/wp-rocket/issues/3142#issuecomment-1345568914
    https://github.com/wp-media/wp-rocket/issues/3142#issuecomment-1515540293
    https://github.com/wp-media/wp-rocket/issues/3142#issuecomment-1833527583
    So instead of having your users double click you could disable the JS delay, or disable the mobile caching, nether is ideal, but I can’t think of any other ideas.
    Unless there is anything else we can assist with on this issue, shall we close this thread then?

    Best regards,
    Mike

    #1427952

    Mike,

    exactly. The only *real* solution would be to rebuild the burger menu js so that we could make sure to exclude all it´s parts. To circumvent the issue I even tried the fastclick library but it also obviously does not really solve the issue.

    Yes please close and thanks again!

    Best,
    Elmar

Viewing 28 posts - 1 through 28 (of 28 total)
  • The topic ‘Burger Menu JS click action is deferred by WP-Rocket’ is closed to new replies.