Keyboard navigation is one of the fastest ways to assess accessibility in WordPress.
If a site can’t be used without a mouse, it’s not accessible — no matter how good it looks.
If a site can’t be used without a mouse, it’s not accessible — no matter how good it looks.
This is also where many WordPress themes quietly fail: menus that only work on hover, invisible focus states, and missing skip links.
Let’s break down the most common issues and how to fix them.
Let’s break down the most common issues and how to fix them.
Keyboard Navigation in WordPress: Menus, Focus and Common Failures
Table of Contents
Skip to Content: The Most Overlooked Fix
A “Skip to content” link allows keyboard and screen reader users to bypass repetitive navigation and jump straight to the main content.
Why it matters
How it should work
Example:
<a class="skip-link" href="#main">Skip to main content</a>
If your theme doesn’t include it, accessibility starts already compromised.
Golden rule:
Skip links must be visually hidden, not accessibility-hidden.
If screen readers can’t reach them, they’re useless.
Golden rule:
Skip links must be visually hidden, not accessibility-hidden.
If screen readers can’t reach them, they’re useless.
In FSE themes you have to put the skip-link in
Then, to make the skip-link accessible only to those who need it, you can use the following CSS:
header pattern, in standard themes you’ll have to edit the template header.php.Then, to make the skip-link accessible only to those who need it, you can use the following CSS:
.skip-link {
position: absolute;
top: -9999px;
left: 0;
background: #000;
color: #fff;
padding: 8px 12px;
z-index: 1000;
}
.skip-link:focus,
.skip-link:focus-visible {
top: 0;
}If you apply this tecnique, you’ll get a false positive while testing your website with automated tools like Lighthouse.
For example, Lighthouse reports that in this page (and in the whole website) the skip link is not focusable. But try to navigate using TAB and you’ll see by yourself that the skip link is focusable and usable through the keyboard.
Golden rule:
Automated tools can flag real accessibility issues — but they can also miss context.
Manual testing always wins.
For example, Lighthouse reports that in this page (and in the whole website) the skip link is not focusable. But try to navigate using TAB and you’ll see by yourself that the skip link is focusable and usable through the keyboard.
Golden rule:
Automated tools can flag real accessibility issues — but they can also miss context.
Manual testing always wins.
:focus vs :focus-visible (And Why It Matters)
Removing focus outlines is one of the most common accessibility mistakes in WordPress themes.
The problem
Designers often add:
:focus {
outline: none;
}Result:
The modern solution
Use
Example:
:focus-visible to style focus only when needed.Example:
:focus-visible {
outline: 2px solid #005fcc;
outline-offset: 2px;
}This keeps the UI clean for mouse users and usable for keyboard users.
Dropdown Menus That Work Without a Mouse
WordPress menus often break keyboard navigation when dropdowns rely solely on hover.
Common failures
Accessible behavior
These issues are often invisible until you:
If your menu works only on hover, it’s not accessible.
Important note
In the WordPress Navigation block, hover is bound to the menu item, but keyboard activation is bound to a separate button.
This creates an interaction mismatch that developers should actively fix. The trick is simple. Just add this small script to the footer of your website (using WP Code or any other plugin that allow you to add custom code to WordPress):
This creates an interaction mismatch that developers should actively fix. The trick is simple. Just add this small script to the footer of your website (using WP Code or any other plugin that allow you to add custom code to WordPress):
document.addEventListener('keydown', function (e) {
if (e.key !== 'Enter' && e.key !== ' ') return;
const link = e.target.closest(
'.wp-block-navigation-item.has-child > .wp-block-navigation-item__content'
);
if (!link) return;
const toggleButton = link.parentElement.querySelector(
'.wp-block-navigation-submenu__toggle'
);
if (!toggleButton) return;
e.preventDefault();
toggleButton.click();
});
How to Run a Quick Keyboard Navigation Test
You don’t need tools to catch most keyboard issues.
Simple test
- Open your site
- Put the mouse aside
- Use only:
- Tab
- Shift + Tab
- Enter
- Esc
What to check
If you get lost, stuck, or confused, the site fails the test.
Why Keyboard Navigation Improves Everything
Fixing keyboard navigation:
In WordPress, keyboard accessibility is not an edge case — it’s a baseline.
🔗 This article is part of a broader guide on the most critical accessibility areas in WordPress: 6 Expert Techniques to Enhance Accessibility in WordPress


Leave a Reply