Accessibility

Accessible navigation menus that don't break screen readers

TS Talha Shahzad··4 min read
The short version
  • Navigation menus are the most heavily litigated design elements due to keyboard exclusion errors.
  • Dropdown submenus must open, close, and navigate using standard keyboard Tab, Enter, and Escape keys.
  • Use ARIA attributes like aria-expanded and aria-haspopup to communicate menu states to screen readers.
  • Mobile hamburger menus must manage focus states programmatically to prevent background link loops.

If you are auditing your website layout, you need to ask: how do I make my website menu accessible? The navigation menu is the front door of your site. If a visitor cannot navigate your menu, they cannot access your service pages, read your content, or reach your checkout.

Unfortunately, navigation menus are the most common source of compliance failures on the web.

Designers love creating complex "mega-menus" with multiple columns of links, or slide-out "hamburger" menus on mobile viewports that look sleek visually. But under the hood, these menus are routinely coded in a way that completely excludes keyboard-only and screen-reader users, making your website an immediate target for ADA litigation.

The hover state trap

The most common accessibility error on desktop menus is the hover-only dropdown.

You design a menu where hovering your mouse over "Services" reveals a list of sub-links (e.g., Service A, Service B).

This creates an immediate barrier:

  • No hover for keyboard users: A user tabbing through the page using their keyboard cannot hover. They will tab onto the "Services" link, but the dropdown menu will remain hidden.
  • Skipped links: When they press Tab again, the focus will move to the next visible link in the header (like "Contact"), skipping all the sub-services entirely. The user has no way to access your key landing pages.

To fix this: Dropdown menus must not rely solely on hover states. You must use JavaScript to toggle the menu open and closed when the parent item receives keyboard focus or when the user presses the Enter key.

Programmatic communication: using ARIA attributes

A screen-reader user cannot see the visual dropdown slide open. Your code must communicate the state of the menu programmatically.

To build an accessible dropdown menu, you must use standard HTML5 navigation tags and ARIA (Accessible Rich Internet Applications) attributes:

  1. Use <nav> wraps: Wrap your header menu in a <nav> tag, and use aria-label="Main Navigation" to define its purpose. This helps screen readers find the menu instantly.
  2. Identify menu buttons: If a menu item triggers a dropdown, do not make it a standard link (<a>). Make it a <button> element, and add aria-haspopup="true" or aria-haspopup="menu". This warns the user that clicking the element will open a menu.
  3. Toggle the expanded state: Add aria-expanded="false" to the button by default. When the user opens the menu (via mouse hover, click, or keyboard Enter), use JavaScript to update the attribute to aria-expanded="true". This tells screen-reader users that the submenu is now open and readable.

Without these attributes, a blind user has no idea that clicking "Services" has changed the page layout.

Want a website that turns visitors into customers, not just compliments?

Book a 15-min intro

The mobile hamburger menu trap

Mobile navigation menus represent a massive litigation liability. These menus typically hide all links behind a hamburger icon. When clicked, a full-screen drawer slides out.

If you do not manage focus states programmatically, the menu becomes a trap:

  • Background tabbing: When the mobile menu slides open visually, the browser's focus remains on the background page. A keyboard user will press Tab, but instead of highlighting the links inside the mobile menu, the focus ring will stay hidden behind the overlay, tabbing through the links on the home page.
  • The Exit Block: The user cannot reach the "Close" button inside the mobile menu because the keyboard focus is locked on the background.

To build an accessible mobile menu:

  1. Focus trap: When the mobile menu opens, use JavaScript to focus the keyboard cursor on the very first link inside the menu. Keep the focus trapped inside the mobile drawer. The Tab key should only loop through the menu links and the close button.
  2. Escape key support: Ensure that pressing the Escape key immediately closes the mobile menu and returns the keyboard focus to the main hamburger button.
  3. Hide background content: When the menu is open, apply aria-hidden="true" to your main page wrapper. This tells screen readers to ignore the background content until the menu is closed, preventing duplicate readings.

Testing your menu layout

Unplug your mouse and run a simple operability check:

  • Tab through your main menu. Ensure you can see a high-contrast focus ring on every link.
  • Can you open your dropdowns or mega-menus using only the Enter or Space keys?
  • Can you navigate through all the sub-links in the dropdown?
  • Does pressing the Escape key close the open dropdown and return your focus to the parent menu button?

If your menu fails these tests, your templates have structural violations. If you are struggling with keyboard blocks or custom JavaScript navigation scripts, a targeted front-end navigation and accessibility audit can clean up your header code. Secure your menu, protect your pages, and build navigation that serves every customer.

Prefer to hire through Upwork?
Top Rated Plus, 100% Job Success, 450+ projects shipped. See the reviews and start a contract.
Hire me on Upwork

FAQ

How do I make my website menu accessible?

Ensure all menu links are navigable by keyboard, style visible focus outlines, use standard HTML nav elements, add ARIA attributes for dropdown states, and ensure mobile hamburgers focus keyboard navigation inside the open drawer.

What ARIA attributes do dropdown menus need?

Use aria-haspopup="menu" or aria-haspopup="true" on the button trigger, and dynamically update aria-expanded="true" or aria-expanded="false" when the dropdown opens and closes.

How do I test if my mega-menu is accessible?

Unplug your mouse and use the Tab key. Verify that you can highlight every main link, expand submenus using Enter or Space, navigate all sub-links, and close the menu using the Escape key without visual blocks.

All posts
the next step is small

Want a site that does this for you?

15 minutes, no deck, no pressure. Worst case, you leave with a free plan.

keep reading

More notes