Accessibility Pitfalls of WordPress Menus
By Captain Accessible (aka Deneb Pulsipher) �of SeaMonster Studios
Why’s it so essential to make sure your menu is accessible?
Getting around is hard without a good navigation menu that works for everyone
You’re in a race against time
Average number of seconds spent on a page*
Average number of pages visited per session**
Average depth of best-converting call to action
54
5-7
??
Menus may save bounces
What problems might be lurking in your WordPress menu?
Problem 1 - Menu only drops down on :hover not :focus or click
⬅︎ with :hover
with :focus ➡︎
What’s it look like?
Menu on :hover
What’s it look like?
Menu on :focus
Problem 1 - Menu only drops down on :hover not :focus or click
Who it affects:
⬅︎ with :hover
with :focus ➡︎
Problem 2 (if dropdown works on focus) - No pull up ability
Who it affects:
Why it’s a problem
Illustration - crazy-tab-stops.jpg
*unless you implement arrow-key navigation
Problem 3 - No aria-expanded attribute
Who it affects:
Why it’s a problem
Best practice for menus:
Illustration -
Assessing the Problems
How to Assess - Keyboard and Screen Reader
Keyboard:
Screen reader:
Inspect
Illustration -
How to Assess - Inspect
Keyboard:
Screen reader:
Inspect →
Illustration -
How to Assess: Inspect
Find the element that triggers the dropdown and see if it has aria-expanded on it (or adjacent elements)
My assessment of 15 theme sites and 5 other big ones
The bad news
The good news
What solutions can you implement on your WordPress menu?
Solution - PHP Remediation
What is it:
How to do it:
Illustration
Solution (dropdown only on :hover) - CSS Remediation
What is it:
Solution - CSS Remediation
How to do it:
Solution (missing aria-expanded) - JS Remediation
What is it:
How to do it:
Solution - JS Remediation
In addition to setting initial aria-expanded attributes, you’ll need to add an event listener on “focus” that sets the aria-expanded to “true”, and another one on “blur” that sets it back to “false”.
dropDownItems[i].addEventListener(“focus”, toggleAriaExpanded();)
Enhancement - Arrow-key Navigation
What is it:
How to do it:
The Easy Way: install Crow’s Nest plugin
Wouldn’t you rather have this guy on your lake?
Make sure your menu drops down on focus as well as hover
Adjust your CSS to add :focus trigger for :hover styles
Make sure your menu has a mechanism to suck back up for keyboard and screen-reader users
Or add arrow-key navigation
Make sure your menu has the proper aria attributes so it can be understood by screen readers