Commit 40a123ae authored by catch's avatar catch
Browse files

Issue #3208286 by mherchel: Olivero: "topLevelMenuITem" variable should be "topLevelMenuItem"

parent 9de43c21
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -7,13 +7,13 @@
  /**
   * Shows and hides the specified menu item's second level submenu.
   *
   * @param {element} topLevelMenuITem - the <li> element that is the container for the menu and submenus.
   * @param {element} topLevelMenuItem - the <li> element that is the container for the menu and submenus.
   * @param {boolean} [toState] - Optional state where we want the submenu to end up.
   */
  function toggleSubNav(topLevelMenuITem, toState) {
  function toggleSubNav(topLevelMenuItem, toState) {
    const buttonSelector =
      '.primary-nav__button-toggle, .primary-nav__menu-link--button';
    const button = topLevelMenuITem.querySelector(buttonSelector);
    const button = topLevelMenuItem.querySelector(buttonSelector);
    const state =
      toState !== undefined
        ? toState
@@ -33,13 +33,13 @@
        });
      }
      button.setAttribute('aria-expanded', 'true');
      topLevelMenuITem
      topLevelMenuItem
        .querySelector('.primary-nav__menu--level-2')
        .classList.add('is-active-menu-parent');
    } else {
      button.setAttribute('aria-expanded', 'false');
      topLevelMenuITem.classList.remove('is-touch-event');
      topLevelMenuITem
      topLevelMenuItem.classList.remove('is-touch-event');
      topLevelMenuItem
        .querySelector('.primary-nav__menu--level-2')
        .classList.remove('is-active-menu-parent');
    }
+5 −5
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@
  var isDesktopNav = Drupal.olivero.isDesktopNav;
  var secondLevelNavMenus = document.querySelectorAll('.primary-nav__menu-item--has-children');

  function toggleSubNav(topLevelMenuITem, toState) {
  function toggleSubNav(topLevelMenuItem, toState) {
    var buttonSelector = '.primary-nav__button-toggle, .primary-nav__menu-link--button';
    var button = topLevelMenuITem.querySelector(buttonSelector);
    var button = topLevelMenuItem.querySelector(buttonSelector);
    var state = toState !== undefined ? toState : button.getAttribute('aria-expanded') !== 'true';

    if (state) {
@@ -23,11 +23,11 @@
      }

      button.setAttribute('aria-expanded', 'true');
      topLevelMenuITem.querySelector('.primary-nav__menu--level-2').classList.add('is-active-menu-parent');
      topLevelMenuItem.querySelector('.primary-nav__menu--level-2').classList.add('is-active-menu-parent');
    } else {
      button.setAttribute('aria-expanded', 'false');
      topLevelMenuITem.classList.remove('is-touch-event');
      topLevelMenuITem.querySelector('.primary-nav__menu--level-2').classList.remove('is-active-menu-parent');
      topLevelMenuItem.classList.remove('is-touch-event');
      topLevelMenuItem.querySelector('.primary-nav__menu--level-2').classList.remove('is-active-menu-parent');
    }
  }