[Resolved] Clicking the arrow on menu parent on mobile Chrome does not work

Home Forums Support Clicking the arrow on menu parent on mobile Chrome does not work

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #1395927
    Leo
    Staff
    Customer Support

    I’ve cleared my browser cache and tried incognito mode but still seeing LiteSpeed Cache in the source code – the as Tom is seeing here:
    https://generatepress.com/forums/topic/clicking-the-arrow-on-menu-parent-on-mobile-chrome-does-not-work/#post-1395873

    Any chance you can check with your hosting support to see if there are any sort of server level cache that’s holding on to this?

    #1396002
    Sebastien

    Thanks for getting back to me Leo, I’ll check with them.

    #1396933
    Sebastien

    Hi guys,

    So I contacted my hosting support team and they confirmed they can load the URLs from this subdomain without hitting a cache. Could you please try again and let me know?

    Many thanks
    Sebastien

    #1396953
    Sebastien

    Last update: I found what is causing the issue. I started disabling all the GP modules to see if it would make a difference with the hovering functionality. And when I disabled the Elements module, the menu hovering started working again. After further investigation, it is because of one element JS code I implemented to use passive listeners and improve scrolling performance (as per Google PageSpeed recommendations). And I basically used the code linked from this thread:

    https://generatepress.com/forums/topic/passive-listeners-to-improve-scrolling-performance/

    The code being:

    <script type="text/javascript">
    (function() {
      var supportsPassive = eventListenerOptionsSupported();  
    
      if (supportsPassive) {
        var addEvent = EventTarget.prototype.addEventListener;
        overwriteAddEvent(addEvent);
      }
    
      function overwriteAddEvent(superMethod) {
        var defaultOptions = {
          passive: true,
          capture: false
        };
    
        EventTarget.prototype.addEventListener = function(type, listener, options) {
          var usesListenerOptions = typeof options === 'object';
          var useCapture = usesListenerOptions ? options.capture : options;
    
          options = usesListenerOptions ? options : {};
          options.passive = options.passive !== undefined ? options.passive : defaultOptions.passive;
          options.capture = useCapture !== undefined ? useCapture : defaultOptions.capture;
    
          superMethod.call(this, type, listener, options);
        };
      }
    
      function eventListenerOptionsSupported() {
        var supported = false;
        try {
          var opts = Object.defineProperty({}, 'passive', {
            get: function() {
              supported = true;
            }
          });
          window.addEventListener("test", null, opts);
        } catch (e) {}
    
        return supported;
      }
    })();
    </script>

    If you have any suggestions to make this code compatible with the hovering functionality on mobile, I would really appreciate it.

    Many thanks
    Sebastien

    #1397085
    David
    Staff
    Customer Support

    Hi there,

    so the passive listeners warning is related to the WP core bug regarding the comments link. Which is something they have yet to resolve. And although the code that user provided works to remove that error we don’t have a solution that stops it from breaking other elements.

    #1397128
    Sebastien

    Hi David, thanks for this. I’ve disabled the code for now.

    #1397230
    David
    Staff
    Customer Support

    Sorry we couldn’t be of more assistance.

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.