Fix aria-required-children in WordPress
Classic WordPress wp_nav_menu() walkers and page-builder mega-menus frequently inject role='menubar' on <ul class='menu'> while leaving <li> elements without role='none' and <a> tags without role='menuitem'. Either remove the invalid role='menubar' so WordPress outputs clean native list navigation, or assign exact WAI-ARIA menu roles throughout.
Before and after
<?php // header.php (Broken: role="menubar" without role="none" / role="menuitem") ?>
<nav aria-label="<?php esc_attr_e( 'Primary menu', 'mytheme' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'items_wrap' => '<ul id="%1$s" class="%2$s" role="menubar">%3$s</ul>',
) );
?>
</nav><?php // header.php (Fixed: clean semantic <ul> navigation inside <nav> landmark) ?>
<nav aria-label="<?php esc_attr_e( 'Primary menu', 'mytheme' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => false,
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
) );
?>
</nav>Fixed vs. broken example
Remove extraneous intermediate wrapper <div>s between a composite ARIA parent and its required children—or set role="none" on purely structural wrappers.
Playwright + axe-core check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("WordPress header navigation and WooCommerce tabs pass aria-required-children", async ({ page }) => {
await page.goto("/");
const results = await new AxeBuilder({ page })
.withRules(["aria-required-children"])
.analyze();
expect(results.violations).toEqual([]);
});Template deduplication tip
A misconfigured role='menubar' in header.php or a custom Walker_Nav_Menu fires on 100% of WordPress posts and pages. Fixing that single PHP walker clears every route in one deploy.
What NVDA and VoiceOver announce
When a container declares role='tablist', role='menu', or role='listbox' without directly owning its required child roles (tab, menuitem, option), assistive technologies break arrow-key navigation, item counts ('1 of 3'), and selection state announcements.
NVDA (Windows)
"Product details, tab control" -> "Specs, button" (item count and selected tab semantics lost)
"Product details, tab control, Specs, tab, selected, 1 of 2"
VoiceOver (macOS / iOS)
"Product details, tab group, 0 items" -> "Specs, button"
"Specs, selected, tab, 1 of 2, Product details, tab group"
Common questions
Why do WooCommerce single-product tabs sometimes fail aria-required-children?
Should WordPress dropdown navigation menus ever use role='menubar'?
How can I fix broken ARIA roles injected by a WordPress plugin?
Test a URL for aria-required-children
Enter any public URL for a free WCAG 2.2 AA check—no account or credit card required.
Managing WordPress client sites? Monitor 15 sites on one flat plan with white-label portals and branded executive PDFs—$1,140/yr ($95/mo billed annually, 24-month rate lock + onboarding) for Founding 10 agencies.