cancel
Showing results for 
Search instead for 
Did you mean: 

Menu becomes crashed when customer login in real mobile device

Menu becomes crashed when customer login in real mobile device

Hi, 

I encounted a mobile view issue.

In the real mobile device the menu become crashed after customer login.but when switch to other pages and then go back to the menu, it displays fine. Also works fine for didn't login.

This issue didn't happen in the Chrome mobile device mode on PC.

Would someone help please. Thanks.

1 REPLY 1

Re: Menu becomes crashed when customer login in real mobile device

Hello @wayneywlau,

 

The issue you're experiencing where the menu crashes after a customer logs in on a real mobile device but works fine on other pages is often due to JavaScript or CSS issues that are specific to real mobile devices. Since this doesn't happen in Chrome's mobile device mode on PC, it's likely related to browser rendering quirks or mobile-specific caching.

 

Here’s a step-by-step approach to debug and fix this issue:

 

        1.Check JavaScript Errors

  • Use Remote Debugging Tools: Chrome provides remote debugging tools for real mobile devices. You can connect your mobile phone to your PC via USB and debug the mobile website in real-time. Here’s how:
    • Open Chrome on your desktop.
    • Go to chrome://inspect/#devices.
    • Enable USB debugging on your phone (Android) and connect it.
    • Start inspecting the mobile version of your site to check for any JavaScript errors in the console when the issue occurs.

Any JavaScript errors that happen after login could be the cause of the crash.

 

     2. CSS/Responsive Design Issues

  • Viewport Specific Styles: Check if there are any styles specifically applied after login that affect the mobile viewport. For instance, the layout might be shifting due to different user data (such as a longer name or additional navigation items).
  • CSS Cache: Sometimes mobile devices cache styles differently than desktop browsers. Try clearing the cache on your mobile device or forcing a refresh by adding a cache-busting parameter to your CSS file URL.

Ex : <link rel="stylesheet" href="style.css?v=1.0">

 

Media Queries: Ensure that media queries are correctly applied after login. Sometimes, the mobile layout might not update correctly when the user logs in due to incorrect breakpoints.

 

    3. Check for Re-rendering Issues

The fact that the menu works fine after switching pages and returning might suggest that the menu is not re-rendering properly after the login. This can happen if JavaScript code that updates the menu is only executed once (e.g., on page load) but not when the customer logs in.

  • Check if Menu Elements are Loaded Correctly: Ensure that any dynamic elements in the menu are properly initialized or re-initialized after login. Some JavaScript frameworks or plugins (like jQuery or Knockout.js) might not re-initialize UI elements on customer login if they depend on the DOM being fully loaded.
  • AJAX or Lazy Loading Issues: If the menu is loaded via AJAX or lazy-loaded after the user logs in, ensure that the process finishes correctly. Sometimes the menu might not fully load until the user navigates away and back.

    4 . Test in a Real Mobile Environment

  • Browser-Specific Issues: Sometimes, specific browsers (like Safari on iOS or Chrome on Android) behave differently than others. Check if the issue is happening on a particular browser. You can also use services like BrowserStack or Sauce Labs to test your site on different real mobile devices and browsers.

By using these steps, you should be able to track down the issue and find the root cause of the menu crash on real mobile devices.

 

If that did not work, I recommend checking out the Milople Magento 2 Mega Menu Extension, that solves your problem if it persists.

 

If the issue will be resolved, Click Kudos & Accept as a Solution.