A submenu trigger must expose aria-expanded
Rule
menuitem-haspopup-expanded· Component patterns (best practice) · impact serious · Static + live
Why it matters
A menuitem that opens a submenu advertises it with aria-haspopup. Without aria-expanded, assistive technology cannot tell whether the submenu is open or closed.
How to fix
Add aria-expanded (true/false) to any menuitem that has aria-haspopup, and keep it in sync.
Example
<div role="menuitem" aria-haspopup="true">More</div>
<div role="menuitem" aria-haspopup="true" aria-expanded="false">More</div>
WCAG success criteria
4.1.2 Name, Role, Value — Level A
Every UI component must expose a correct name, role, and (where relevant) state/value to assistive technology.
Standards
This rule contributes to the following standards:
WCAG A EN 301 549 Best practice
| Standard | Criteria |
|---|---|
| EN 301 549 | 9.4.1.2 |