In the mobile view, the toggle does not work, for logged-in users

Created on 21 June 2023, over 1 year ago
Updated 17 August 2023, over 1 year ago

Problem/Motivation

In the mobile view toggle is not working when the site is logged in. It is working fine when it logged out.

Steps to reproduce

  • Install the theme
  • Add menus
  • Switch on the mobile view
  • Click on the menu-toggle button

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

1.3

Component

Code

Created by

🇮🇳India sonam_sharma

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sonam_sharma
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The issue summary should always describe what should be fixed/changed. Neither the title nor screenshots are sufficient to describe what the issue is, even in the case a patch is provided.
    In the case of a bug, the description should also list the steps necessary to reproduce the issue, starting from when the module/theme is installed.

  • Status changed to RTBC over 1 year ago
  • Hi @sonam_sharma,
    Verified patch #2 on 9.5.8, menu-toggle is working fine on mobile view. Added screenshots for reference, moving to RTBC.
    Thanks

  • 🇮🇳India sonam_sharma

    Thanks @shweta__sharma

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -(function(jQuery){
    -  Drupal.behaviors.awesome = {
    -    attach: function (context, settings) {
    -      // Your custom JavaScript goes inside this function...
    -      jQuery('.mobile-menu', context).click(function () {
    -        jQuery(this).next('.primary-menu-wrapper').toggleClass('active-menu');
    -      });
    -      jQuery('.close-mobile-menu', context).click(function () {
    -        jQuery(this).closest('.primary-menu-wrapper').toggleClass('active-menu');
    -      });
    -      // Full page search.
    -      jQuery('.search-icon').on('click', function() {
    -        jQuery('.search-box').addClass('open');
    -        return false;
    -      });
    -    
    -      jQuery('.search-box-close').on('click', function() {
    -        jQuery('.search-box').removeClass('open');
    -        return false;
    -      });
    -    
    -      // Scroll To Top.
    -      jQuery(window).scroll(function () {
    -        if (jQuery(this).scrollTop() > 80) {
    -          jQuery('.scrolltop').fadeIn('slow');
    -        } else {
    -          jQuery('.scrolltop').fadeOut('slow');
    -        }
    -      });
    -      jQuery('.scrolltop').click(function () {
    -        jQuery('html, body').animate( { scrollTop: 0 }, 'slow');
    -      });
    -    }
    -  };
    -})(jQuery);
    +jQuery(document).ready(function ($) {
    +  // Your custom JavaScript goes inside this function...
    +  $(".mobile-menu").click(function () {
    +      $(this).next(".primary-menu-wrapper").toggleClass("active-menu");
    +  });
    +  $(".close-mobile-menu").click(function () {
    +      $(this).closest(".primary-menu-wrapper").toggleClass("active-menu");
    +  });
    +  // Full page search.
    +  $(".search-icon").on("click", function () {
    +      $(".search-box").addClass("open");
    +      return false;
    +  });
    +
    +  $(".search-box-close").on("click", function () {
    +      $(".search-box").removeClass("open");
    +      return false;
    +  });
    +
    +  // Scroll To Top.
    +  $(window).scroll(function () {
    +      if ($(this).scrollTop() > 80) {
    +          $(".scrolltop").fadeIn("slow");
    +      } else {
    +          $(".scrolltop").fadeOut("slow");
    +      }
    +  });
    +  $(".scrolltop").click(function () {
    +      $("html, body").animate({ scrollTop: 0 }, "slow");
    +  });
    +});

    Drupal modules and themes use Drupal behaviors , not jQuery(document).ready(). That change is not correct.

  • 🇮🇳India sonam_sharma

    ok I'll work on it

  • Assigned to Akshay kashyap
  • 🇮🇳India Akshay kashyap

    I have created a patch to fix the toggle issue in mobile devices. I have added a Drupal behavior and put all the code inside the Drupal behavior. Please review.

  • Status changed to Needs review over 1 year ago
  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • Verified the #11 patch on 9.5.8, the toggle is working for the login user. Added screenshots for reference, RTBC++

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024