Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/accessibility: Keep priority nav dropdown <ul> inside of main <ul> #55

Open
adamjohnson opened this issue Dec 7, 2020 · 0 comments

Comments

@adamjohnson
Copy link

The Current Markup:

<nav>
  <ul>
    <li><a href="#">menu item 1</a></li>
    <li><a href="#">menu item 2</a></li>
    <li><a href="#">menu item 3</a></li>
    <li><a href="#">menu item 4</a></li>
  </ul>

  <span class="nav__dropdown-wrapper priority-nav__wrapper" aria-haspopup="true">
    <button aria-controls="menu" class="nav__dropdown-toggle priority-nav__dropdown-toggle priority-nav-is-visible" prioritynav-count="2">
      more
    </button>
    <ul aria-hidden="true" class="nav__dropdown priority-nav__dropdown">
      <li><a href="#">menu item 5</a></li>
      <li><a href="#">menu item 6</a></li>
    </ul>
  </span>
</nav>

Proposed markup:

<nav>
  <ul>
    <li><a href="#">menu item 1</a></li>
    <li><a href="#">menu item 2</a></li>
    <li><a href="#">menu item 3</a></li>
    <li><a href="#">menu item 4</a></li>

    <li class="nav__dropdown-wrapper priority-nav__wrapper" aria-haspopup="true"> <!-- Keep new <ul> inside the current <ul> -->
      <button aria-controls="menu" class="nav__dropdown-toggle priority-nav__dropdown-toggle priority-nav-is-visible" prioritynav-count="2">
        more
      </button>
      <ul aria-hidden="true" class="nav__dropdown priority-nav__dropdown"> <!-- Needs id="menu" -->
        <li><a href="#">menu item 5</a></li>
        <li><a href="#">menu item 6</a></li>
      </ul>
    </li>
  </ul>
</nav>

Reasoning:

The Priority+ <ul> is directly related to the parent <ul>. The Priority+ <ul> is effectively a dropdown menu within the parent menu. Because of this, the markup should represent the parent/child relationship. I think this would help accessibility and be a benefit for assistive technology users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant