Skip to content

Mobile Menu

The mobile menu component provides a slide-out sidebar menu that provides deep-nesting navigation. The top levels function as expandable accordions to allow for quickly digging into the content, and deeper nester menus slide to the slide to allow multilevel deep navigation without the need to reload the page.

This component requires Drupal to function, hence the examples here are not interactive.

Open Full Example
<div class="uoheader__mobile">
  <button class="uowdf-mobile-menu__button__new" id="uowdf-mobile-menu__button" aria-label="Navigation" aria-expanded="false" aria-haspopup="true" aria-controls="uobanner-sidebar">
    <div class="uowdf-mobile-menu__button__new-bar-1"></div>
    <div class="uowdf-mobile-menu__button__new-bar-2"></div>
    <div class="uowdf-mobile-menu__button__new-bar-3"></div>
    <div class="uowdf-mobile-menu__button__text">Menu</div>
  </button>
</div>
<div class="uowdf-mobile-menu__container" tabindex="-1" inert="" aria-hidden="true">
  <div class="uowdf-mobile-menu" id="uowdf-mobile-menu" data-menu-id="0" style="--current-depth: -1">
    <h2 class="uowdf-mobile-menu__title">Office of the Provost Menu</h2>
    <nav class="uowdf-mobile-menu__menu uowdf-mobile-menu--accordions" role="none">
      <ul class="uowdf-mobile-menu__list" id="uowdf-mobile-menu__list" role="none">
        <li class="uowdf-mobile-menu__list-item">
          <a href="/about-otp" class="uowdf-mobile-menu__link uowdf-mobile-menu__link--leaf"
            data-drupal-link-system-path="node/2573">About Us</a>
        </li>
        <li class="uowdf-mobile-menu__list-item">
          <a href="/academic-excellence" class="uowdf-mobile-menu__link uowdf-mobile-menu__link--leaf"
            data-drupal-link-system-path="node/2465">Academic Excellence</a>
        </li>
        <li class="uowdf-mobile-menu__list-item has-submenu is-leaflet">
          <button class="uowdf-mobile-menu__accordion-button uowdf-mobile-menu__accordion-button--expanded"
            data-depth="0" aria-label="Awards Menu" aria-expanded="true"
            aria-controls="uowdf-mobile-menu__accordion-submenu--0">Awards</button>
          <div class="uowdf-mobile-menu__submenu" data-menu-id="3" data-parent-menu-id="0"
            style="display: block; max-height: none;" id="uowdf-mobile-menu__accordion-submenu--0" role="none">
            <ul class="uowdf-mobile-menu__list" role="none">
              <li class="uowdf-mobile-menu__list-item">
                <a href="https://provost.uoregon.edu/awards" class="uowdf-mobile-menu__link">Awards Overview</a>
              </li>
              <li class="uowdf-mobile-menu__list-item">
                <button class="uowdf-mobile-menu__accordion-button uowdf-mobile-menu__accordion-button--expanded"
                  data-depth="1" aria-label="Distinguished Teaching Awards Menu" aria-expanded="true"
                  aria-controls="uowdf-mobile-menu__accordion-submenu--1">Distinguished Teaching Awards</button>
                <div class="uowdf-mobile-menu__submenu" data-menu-id="34" data-parent-menu-id="3"
                  style="display: block; max-height: none;" id="uowdf-mobile-menu__accordion-submenu--1" role="none">
                  <ul class="uowdf-mobile-menu__list uowdf-mobile-menu--depth-2" role="none">
                    <li class="uowdf-mobile-menu__list-item">
                      <a href="/distinguished-teaching-awards" class="uowdf-mobile-menu__link"
                        data-drupal-link-system-path="node/57">Distinguished Teaching Awards Overview</a>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="uowdf-mobile-menu__list-item">
                <button class="uowdf-mobile-menu__accordion-button uowdf-mobile-menu__accordion-button--expanded"
                  data-depth="1" aria-label="Williams Fund Menu" aria-expanded="true"
                  aria-controls="uowdf-mobile-menu__accordion-submenu--2">Williams Fund</button>
                <div class="uowdf-mobile-menu__submenu" data-menu-id="35" data-parent-menu-id="3"
                  style="display: block; max-height: none;" id="uowdf-mobile-menu__accordion-submenu--2" role="none">
                  <ul class="uowdf-mobile-menu__list uowdf-mobile-menu--depth-2" role="none">
                    <li class="uowdf-mobile-menu__list-item">
                      <a href="/williams-fund" class="uowdf-mobile-menu__link"
                        data-drupal-link-system-path="node/250">Williams Fund Overview</a>
                    </li>
                  </ul>
                </div>
              </li>
            </ul>
          </div>
        </li>
      </ul>
    </nav>
  </div>
</div>

  • Use mobile menus for primary and secondary navigation
  • Use Correct Heading Levels: Ensure the correct heading level is set in the sidebar. By default it will toggle to an H1 on opening since the rest of the page will be obscured, including the main page title.
ElementDescriptionUsageRequiredMultiple
Open/Close ButtonThe button to open the mobile menuPut in the top right corner of your pageYesNo
MenuThe parent menu elementYesNo
TitleThe navigation titleA few words clearly defining what content the user is navigatingYesNo
Parent Menu ButtonExpands child menu items of a parentProvide the button to toggle the listNoYes
ListEach section of pagesNest these for multilevel navigationYesYes
ItemA menu itemUse for each page in the navigationYesYes
Back ButtonReturns to a less nested menu sectionProvide on nested levels 3+NoYes
AttributeElementDescriptionUsageRequired
data-depthParent Menu ButtonThe menu depthStart at 0, increment by one for each nested menuYes
data-menu-idListA unique id for the menuUse a unique integer ID for each menu in the treeYes
data-parent-menu-idListThe parent menu’s IDSet to the data-menu-id of the parent containing menu, omit if no parentNo
Aria LabelDescription
aria-expandedAdded to the button element of the mobile menu. Set to true on the button element when the menu is open. Set to false when the menu is closed.
aria-modalAdded to the menu element of the mobile menu. Set to true on the menu element when the menu is open. Set to false when the menu is closed.
aria-labelAdded to Back Buttons, make this a clear behavior like: “Back to Parent Section Name”
Key CommandDescription
enter or spaceOpen or close the mobile menu when focus is on the button element
tab or shift+tabNavigate through the elements in the menu
enter or spaceOpen or close the accordion or nested menu section when focus is on the parent menu item button
escClose the mobile menu when it is open