-
AuthorPosts
-
December 1, 2023 at 12:02 pm #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.
ElDecember 1, 2023 at 8:41 pm #1426912Hey 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,
MikeDecember 2, 2023 at 6:48 pm #1426975Appreciated 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!
December 2, 2023 at 7:05 pm #1426977Hi,
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,
MikeDecember 2, 2023 at 7:15 pm #1426980Of 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
ElmarDecember 2, 2023 at 8:02 pm #1426984Hi,
\js\avia-snippet-hamburger-menu.js
\js\avia-snippet-hamburger-menu.min.jsare you using the REMOVE UNUSED CSS option in wp-rocket?
Best regards,
MikeDecember 3, 2023 at 7:46 am #1427022Yes, 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.
December 4, 2023 at 5:40 am #1427098Hi,
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,
IsmaelDecember 4, 2023 at 7:29 am #1427103Hi,
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,
ElmarDecember 5, 2023 at 12:38 am #1427176Hi,
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:
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
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,
MikeDecember 5, 2023 at 11:06 am #1427209Mike,
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=sharingBut that seems like the wrong approach. There should be a way within Enfold that the menu takes precedence in the call stack.
Best,
ElmarDecember 5, 2023 at 12:14 pm #1427214Hi,
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,
MikeDecember 7, 2023 at 7:24 pm #1427489Hi Mike,
any news on this? The CDN is not the issue. It really is the why that scripts get delayed.
Best,
ElDecember 8, 2023 at 12:18 am #1427495Hi,
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,
MikeDecember 8, 2023 at 10:15 am #1427543Mike,
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/3142Best,
ElmarDecember 8, 2023 at 12:37 pm #1427556Hi,
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,
MikeDecember 8, 2023 at 3:30 pm #1427574Hi Mike,
You might need to be logged in to see the report.
Best
December 8, 2023 at 4:54 pm #1427582Hi,
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,
MikeDecember 8, 2023 at 6:55 pm #1427601Sure, thatbis the usual way. Most caches are disabled for logged in users. You have to test without being logged in. Everything is circumvented otherwise.
December 9, 2023 at 7:43 pm #1427639Hi,
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,
MikeDecember 11, 2023 at 11:41 am #1427763Hi 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,
ElmarDecember 11, 2023 at 11:49 am #1427765I 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.
December 11, 2023 at 12:10 pm #1427769Hi,
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,
MikeDecember 11, 2023 at 12:16 pm #1427770Hi,
got it. Tried it and made a video as proof. Doesn´t work sadly.
Best,
ElmarDecember 11, 2023 at 6:12 pm #1427797Hi,
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_reviewsI 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,
MikeDecember 12, 2023 at 1:07 pm #1427857Mike,
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,
ElmarDecember 12, 2023 at 11:30 pm #1427915Hi,
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,
MikeDecember 13, 2023 at 7:06 am #1427952Mike,
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 -
AuthorPosts
- The topic ‘Burger Menu JS click action is deferred by WP-Rocket’ is closed to new replies.