Accessible navigation and mega menus

Published 28 October 2026 ยท General information, not legal advice

Build site navigation as a list of ordinary links inside a nav element. Open each dropdown or mega menu with a real button that says whether it is expanded, not on hover alone, and let Escape close it and return focus to that button. Do not use role="menu" for website navigation. Add a skip link, mark the current page, keep the menu in the same order on every page, and make sure the mobile menu works like a dialog.37

Menus are where many stores lose keyboard and screen reader users before they reach a single product. In WebAIM's 2024 survey of screen reader users, "interactive elements such as menus, tabs and dialogs do not behave as expected" ranked second among the most problematic items on the web, after CAPTCHA; "too many links or navigation items" was also on the list.12

Structure: links in a list, inside nav

W3C's menus tutorial asks for markup that reflects the menu's structure and labels it, and clear, familiar visual states such as the current page.1 Shopify's theme guidance is specific: wrap navigation in nav, use aria-current for the current page, and do not use role="menu" or role="menuitem" for site navigation.7

Why not role="menu"? The ARIA Authoring Practices explain that the menu role brings the expectations of a desktop application menu, with arrow-key navigation and other behaviour that ordinary site navigation does not need. Using it on a list of links can mislead screen reader users. Their navigation example uses the disclosure pattern instead.3

Dropdowns and mega menus: the disclosure pattern

A dropdown or mega menu is a set of links hidden until a button shows them. The ARIA example navigation menu works like this:3

Key or attributeBehaviour
Tab / Shift+TabMoves between the top-level buttons and, when a dropdown is open, through its links
Enter or Space on a buttonOpens or closes its dropdown
EscapeCloses the open dropdown and returns focus to its button
Arrow keys, Home, EndOptional extras that move between items; they add to Tab, they do not replace it
aria-expanded"true" when the dropdown is open, "false" when closed
aria-controlsPoints from the button to the container it shows or hides
aria-current="page"On the link to the page being shown, one at a time

Shopify's theme guidance matches it: Enter and Space open the menu, focus stays on the button and Tab moves into the first item, and Escape closes it and returns focus to the button.7 Shopify Theme Store themes must also make dropdown navigation keyboard accessible.8

When the top-level item is also a link

Many stores want "Women" to go to a women's collection page and also open a dropdown. W3C's fly-out menu tutorial covers this: add a separate button next to the link, with a hidden label such as "Show Women submenu", that opens and closes the submenu. If the top-level item only summarises its submenu, the item itself can be the button.2 It also advises that submenus should not open just because someone tabs past, so keyboard users are not forced through every link.2

Hover menus

Opening on hover is fine as long as it is not the only way. When a menu appears on hover or focus, WCAG 1.4.13 (level AA) asks that it can be dismissed without moving the pointer, for example with Escape; that the pointer can move onto it without it closing; and that it stays open until dismissed or the pointer leaves.4 W3C's fly-out tutorial suggests a short delay before closing when the pointer leaves, and uses one second in its example, which helps people with less precise mouse control.2

Mega menus need extra care

  • Headings inside the panel. If a mega menu groups links under "Shoes", "Bags" and "Accessories", mark those as headings or group labels so a screen reader user hears the structure.
  • Images with purpose. A promotional image in a mega menu that is a link needs alt text saying where it goes; one that only decorates needs empty alt text.
  • Not too many links. Every link in an open mega menu is a Tab stop. Keep panels closed until asked for, and keep them focused.
  • Other routes. W3C notes that fly-out menus can be hard for people with reduced dexterity and suggests also providing the submenu links elsewhere, such as on the parent page.2

Mobile menus

On phones, most themes put navigation in a drawer that slides over the page. If it covers the page and blocks interaction with it, treat it as a modal dialog: focus moves into the drawer when it opens, Tab stays inside, Escape closes it, and focus returns to the menu button.10 Shopify's guidance for theme drawers says the same.7 The menu button needs a name, such as "Menu", and should say whether it is expanded. Nested levels inside the drawer follow the same disclosure pattern as on desktop.

Keep the buttons big enough to tap. WCAG 2.2's 2.5.8 Target Size asks for at least 24 by 24 CSS pixels, or enough space around smaller targets.9

The rest of the header

  • Skip link. WCAG 2.4.1 asks for a way to bypass blocks repeated on every page; a link at the top that goes straight to the main content is the usual technique.5 Shopify's guidance is to make it visible when focused.7
  • Same order on every page. WCAG 3.2.3 (level AA) asks that navigation repeated across pages appears in the same relative order each time.6
  • Sticky headers. A header that stays at the top of the screen must not completely hide whatever has keyboard focus as people tab down the page, which fails 2.4.11 Focus Not Obscured (Minimum). W3C lists CSS scroll-padding as a fix.11
  • Icon links. Search, account and cart icons need names, ideally including the cart count: "Cart, 2 items".

Test your menu in five minutes

  1. Tab from the address bar. Is the first stop a skip link?
  2. Tab to a top-level item with a dropdown. Can you open it with Enter or Space, tab through its links, and close it with Escape, landing back on the button?
  3. Tab past a closed dropdown. Do you skip over its links?
  4. With a screen reader, listen to a dropdown button. Does it say "collapsed" or "expanded"?
  5. On a phone or narrow window, open the mobile menu, move through it, and close it without touching the page behind.
  6. Run an automated check. Jralo's free check catches links and buttons with no name and other WCAG 2.2 A and AA failures on your homepage and up to five linked pages, and points to the countries whose accessibility laws are likely relevant to your site. Whether a menu opens, closes and returns focus properly needs a person; automated testing finds many problems, not all.

The menu is usually one template shared by every page, so a fix there improves the whole site. For a safe way to change it, see fixing accessibility without breaking your theme, and for the full keyboard pass, how to test with only a keyboard in 10 minutes.

Questions people ask

Should I use role="menu" for my website navigation?

No. The menu role is for application-style menus and tells screen readers to expect arrow-key behaviour that site navigation does not have. W3C's ARIA examples and Shopify's theme guidance both use plain links in a nav element, with buttons that show and hide dropdowns.

Can my dropdown menu open on hover?

Yes, as long as hover is not the only way. Keyboard users need a button to open it. Under WCAG 1.4.13, content that appears on hover or focus must be dismissible without moving the pointer, stay open while the pointer moves onto it, and remain until dismissed.

What should happen when a top-level menu item is also a link?

Keep the link and add a separate button beside it that opens and closes the submenu, with a hidden label such as Show Women submenu and aria-expanded to report its state. That way the link still goes to its page and keyboard users can reach the submenu.

Check your site now

Jralo's free check tests your homepage and up to five pages for accessibility (WCAG 2.2 A and AA) and website QA problems, and tells you which countries' accessibility laws are likely relevant to you. No sign-up.

Run the free check

Sources

Every number and legal statement in this post links to one of these sources, read on 13 October 2026.

  1. W3C WAI: Menus Tutorial
  2. W3C WAI: Menus Tutorial, Fly-out Menus
  3. W3C WAI-ARIA Authoring Practices: Example disclosure navigation menu
  4. W3C WAI: Understanding Success Criterion 1.4.13 Content on Hover or Focus
  5. W3C WAI: Understanding Success Criterion 2.4.1 Bypass Blocks
  6. W3C WAI: Understanding Success Criterion 3.2.3 Consistent Navigation
  7. Shopify: Accessibility best practices for Shopify themes
  8. Shopify: Theme Store requirements
  9. W3C: Web Content Accessibility Guidelines (WCAG) 2.2
  10. W3C WAI-ARIA Authoring Practices: Dialog (Modal) pattern
  11. W3C WAI: Understanding Success Criterion 2.4.11 Focus Not Obscured (Minimum)
  12. WebAIM: Screen Reader User Survey #10 results (2024)

More questions

Related on Jralo