Search topics
Hover-only dropdowns, or ones that never say they are open
A submenu is shown by a :hover rule alone, so Tab skips every page in it, or it opens from a button that never says whether the list is open.
.has-sub:hover > ul { display: block; } The problem
Keyboard users can't reach the pages listed under a top-level menu item, and screen reader users can't tell that they are there or whether the list is open
A furniture shop's header has three items: Home, Products and About. Move the mouse over Products and a list drops down under it: Lamps, Chairs and Rugs. Put the mouse aside and press Tab instead. Focus goes to Home, then Products, then About. The list never appears, and nothing on screen or in the screen reader suggests it exists. On Products, a screen reader says "Products, link", just as it says "Home, link", and when a pointer opens the list, nothing is announced either. Enter on Products follows its link to an overview page, so a keyboard user can still reach the shop, but each category page is two or three clicks further away, or not linked from anywhere else at all.
The same header is often built with Products as a button instead. Press it, with a click, Enter or Space, and the list opens, now with All products at the top, and Tab moves on into it, so the keyboard does reach Lamps. A screen reader user hears none of this. On Products it says "Products, button", and after Enter it says nothing new. Pressing it again closes the list just as silently, so they can't tell whether the list is open, or that the links after the button belong to it.
The submenu is hidden with display: none and shown by a single rule, .has-sub:hover > ul. Hover is something only a pointer can do, so the links inside the list can't receive focus while it is hidden, and nothing a keyboard can do will show it. WCAG 2.1.1 Keyboard requires that everything the page offers can be done with a keyboard, and reaching those links is part of what it offers. The button passes this: a native button responds to Enter and Space, and the open list's links follow it in the Tab order.
4.1.2 Name, Role, Value asks that a control's name, role and state can be read by assistive technology, and that changes to them are reported. The button fails it plainly. Products is a button that shows and hides a list, so it has a state, open or closed, and with no aria-expanded nothing exposes it. Toggling hidden changes what is drawn and what Tab can reach, not what the button reports, so a screen reader says "Products, button" whether the list is open or not.
The hover menu fails 4.1.2 for the same reason, less plainly. For a mouse user Products works as a control, since resting on it opens the list, but it is a plain link, and a :hover rule changes only what is drawn. Nothing in the markup says a list belongs to it, or whether that list is open, so a screen reader can only say "Products, link". Some auditors report the hover menu under 2.1.1 alone, reasoning that the link has its name and role and that hover belongs to the pointer, not to the link; the audit reports it under 2.1.1 too. The fix is the same either way: a control that opens the list from the keyboard and says whether it is open.
Touch screens have no hover either. Some browsers open the list on the first tap and follow the link on the second, others follow the link straight away, so whether a phone user ever sees the list depends on the browser.
3 of 10 groups affected
- No vision (affected)
- Low vision (affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (affected)
- Reach, strength (not affected)
- Cognitive (not affected)
- Seizures (not affected)
- Limited manipulation Keyboard and switch users tab from Products straight to About, so the pages listed under Products can't be reached from the menu at all. Voice control users can say "click Products", but that follows the link; there is no command for hover.
- Without vision Screen reader users hear "Products, link" with nothing to say pages sit beneath it, and the hidden links are not in what they can read or tab to. Where Products is a button with no expanded state, they hear "Products, button" before and after pressing it, and can't tell whether the list opened.
- Limited vision People with low vision who find a pointer hard to track, and use the keyboard instead, meet the same closed list: Tab passes over Products and the pages under it never appear.
A scanner reads the markup: valid links inside a list inside a nav. It doesn't hover, so it never sees the submenu open, and it doesn't compare what a mouse can reach with what Tab can reach. Hidden links aren't reported, because hiding closed content is correct. AI coding tools asked to make the menu accessible often add role="menubar" and role="menuitem". That is not a fix: those roles promise the arrow-key behaviour of an application menu, which the code then has to supply, and on a site's navigation they make screen readers switch modes and announce a menu that isn't one, as navigation menus built as an app's menu bar shows. Others add aria-haspopup="true" to a link, which announces a popup that still can't be opened.
The button passes a scan too: it has a name and a role, and nothing requires aria-expanded on a button. The audit goes further. It rests the pointer on each menu item and then focuses it from the keyboard, and reports a list that opens on hover but not on focus; on a button, it presses Enter and reports one that opens a list without saying it is open. Putting the mouse aside, tabbing through the header and listening to it with a screen reader is still how to confirm either.
Try it
Reach Lamps using only Tab and Enter
Broken 1: hover over Products with a mouse to see the list, then try the keyboard. Tab goes from Products to About, and the panel says only "Products, link", with nothing about a list.
Broken 2: Products is a button. Press Enter and the list opens, and Tab reaches Lamps, but the panel says "Products, button" before and after, never whether the list is open.
Apply the fix. With the list open, try Escape, and keep tabbing past About: does the list cover the next link?
Broken Can you fix this?
This week's offer: Spring sale
The fix
Open each submenu by keyboard, and say whether it is open
A submenu shown on hover
<nav aria-label="Main"> <ul class="menu"> <li> <a href="/">Home</a> </li> <li class="has-sub"> <a href="/products">Products</a> <ul> <li> <a href="/products/lamps">Lamps</a> </li> <li> <a href="/products/chairs">Chairs</a> </li> <li> <a href="/products/rugs">Rugs</a> </li> </ul> </li> <li> <a href="/about">About</a> </li> </ul></nav>What is wrong2 points
- Tab never reaches the three category pages: it goes from Products straight to About, because their links are
display: noneuntil a pointer rests on Products. - A screen reader says only "Products, link", with nothing about a submenu, because nothing in the markup says Products has one.
A button that opens the submenu
<nav aria-label="Main"> <ul class="menu"> <li> <a href="/">Home</a> </li> <li class="has-sub"> <button type="button" aria-expanded="false" aria-controls="sub-products">Products</button> <ul id="sub-products" tabindex="-1" hidden> <li> <a href="/products">All products</a> </li> <li> <a href="/products/lamps">Lamps</a> </li> <li> <a href="/products/chairs">Chairs</a> </li> <li> <a href="/products/rugs">Rugs</a> </li> </ul> </li> <li> <a href="/about">About</a> </li> </ul></nav>How it is fixed7 steps
- Make Products a native button, which opens and closes with Enter and Space.
- Give it
aria-expanded, kept in step withhidden, so a screen reader says "Products, button, collapsed", then "expanded". - Tie the list to the button with
aria-controls. The list follows the button in the markup, so Tab goes straight from the button into the open list, andhiddenkeeps the links out of the Tab order while it is closed. - Close the list on Escape, and put focus back on Products.
- Close it when focus moves out of the item, with Tab, Shift + Tab or a click elsewhere, without moving focus anywhere, so an open list never covers the next thing people tab to.
- Put
tabindex="-1"on the list, so a click inside it keeps focus within the item, and that click doesn't count as leaving. - The button no longer goes to the overview page, so move that page into the list as "All products".
This fixes both Befores and passes 2.1.1 and 4.1.2. Against the second Before, the button and its click toggle stay; what this adds is aria-expanded, aria-controls and the two ways to close, Escape and focus leaving.
Why this fix: Use native HTML first
Use the button. It passes on its own, with nothing left that depends on the page around it: it says whether the list is open, closes on Escape and when focus leaves, and adds a single Tab stop per submenu. If your menu already has buttons, as in the second Before, it is also the shortest path: add aria-expanded and the two ways to close. details and summary need no script and are a sound choice where the open list pushes the page down, but over the page they stay open behind the user. Opening on :focus-within is the smallest change to an existing menu and stops the worst of the failure while the button is built, but it can't be closed with Escape and doesn't tell screen reader users the list is there.
A top-level item that is also a page needs a choice. Moving the page into the list as "All products", as in the snippets, keeps one control per item. If the item must stay a link, put the link and a separate small button side by side, and give the button a name such as "Products pages" so it doesn't read as a second "Products". Don't make the link open the list itself, on Enter or on a first tap: dropdown parent links that open the submenu, not the page shows what that does.
Other parts of a real menu each need their own answer.
- Hover: you may keep opening the list on hover for mouse users. Then it is content that appears on hover, which 1.4.13 asks to stay open while the pointer moves onto it and to close on Escape; hover content covers this.
- Arrow keys: optional for a site menu. The disclosure pattern works with Tab alone; if you add arrow keys between top-level buttons, keep Tab working as well.
aria-haspopup: leave it out. On a button it announces a menu, and this list is a set of links, not a menu.- Mobile: the same buttons work in a narrow-screen menu, where the lists stack and push content down. The "Menu" button that opens the whole panel follows the same pattern.
- Current page: when a category page is open, mark its link with
aria-current="page", as current-page explains.
Design ideas
A dropdown can open for the keyboard too
Four ways to draw the same shop header. Point at Products, then put the mouse aside and Tab through each: press Enter on a button, Escape with a list or panel open, and keep tabbing on to Spring sale. Three open for everyone or have nothing to open; in the last, only a mouse can open the list.
In the design file
- Decide whether Products goes to its own page or opens a list. If it opens a list, put an “All products” link inside it.
- If an arrow button next to a link opens the list, give it a name, such as “Products pages”.
- Draw focus on the menu button and on each link in the open list.
- Draw the phone menu, with the lists stacked under one Menu button that pushes the page down when it opens.
Passes
This week’s offer: Spring sale
Products link with its own chevron button Products stays a link to its overview, and a round 32px chevron button beside it, #1a1a1a on #f0ede7 at 14.90:1, opens the pages in a floating card and turns over while it is open. The overview stays one click away, at the cost of one more Tab stop and a name for the button, such as “Products pages”.Rule of thumb: Use native HTML first
- A Menu button that opens a panel Every page sits in one panel under a dark Menu pill, white on #1a1a1a at 17.40:1, the products as small pills. The panel pushes the offer down instead of covering it, so it can stay open while you tab on; Escape closes it.
This week’s offer: Spring sale
No dropdown: the pages as a row of pills Lamps, Chairs and Rugs sit under the header all the time, so there is nothing to open, hover or find. It costs a row of height and three more Tab stops, so it suits a short menu.
Fails
- A chevron that only a click opensWCAG 2.1.1 It looks the same as the chevron button, but the chevron is only a drawing with a click on it. Tab goes from Products straight to About, so Lamps, Chairs and Rugs open for a mouse and never for the keyboard.
Rule of thumb: Make a gesture a shortcut, never the only way
Verify the fix
5 checks, no mouse.
Test with: Keyboard, Screen reader, Zoom, Touch
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared header or menu component changes.
How screen readers handle aria-expanded
Limits
This is a starting pattern for a site's navigation menu, not for application menus with commands, which follow the ARIA menu pattern and its arrow keys. The script is a minimal sketch without animation, hover opening or nested levels; a sidebar whose sections hold further sections is covered in tree views keyboards can't open and screen readers flatten. Test the complete journey, including your narrow-screen menu, with your target assistive technology.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
References
- WCAG Understanding: keyboard (opens in a new tab)
- WCAG Understanding: name-role-value (opens in a new tab)
- ARIA APG: disclosure-navigation (opens in a new tab)
- WAI Tutorial: menus/flyout (opens in a new tab)
- WCAG Understanding: content-on-hover-or-focus (opens in a new tab)
- WCAG Understanding: focus-not-obscured-minimum (opens in a new tab)
- developer.mozilla.org: details (opens in a new tab)
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.