| id | m6b1q3 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| name | Menuitem has non-empty accessible name | ||||||||||
| rule_type | atomic | ||||||||||
| description | This rule checks that each element with a `menuitem` role has a non-empty accessible name. | ||||||||||
| accessibility_requirements |
|
||||||||||
| input_aspects |
|
||||||||||
| acknowledgments |
|
This rule applies to HTML elements that is a semantic menuitem included in the accessibility tree.
Each target element has an accessible name that is not empty ("").
This rule assumes that all menuitems are user interface components as defined by WCAG 2. If an element has a role of menuitem that would not be perceived as a single control by users, 4.1.2 Name, Role, Value would not apply and so failing this rule would not result in a conformance issue.
- Implementation of Presentational Roles Conflict Resolution varies from one browser or assistive technology to another. Depending on this, some semantic
menuitemelements can fail this rule with some technology but users of other technologies would not experience any accessibility issue. aria-busyexists but, currently, is not widely supported, so the rule ignores it.
- Understanding Success Criterion 4.1.2: Name, Role, Value
- ARIA14: Using aria-label to provide an invisible label where a visible label cannot be used
- ARIA16: Using aria-labelledby to provide a name for user interface controls
This element with the menuitem role has an accessible name because of its text content.
<div role="menu">
<button role="menuitem">New file</button>
</div>This element with the menuitem role has an accessible name because of its aria-label attribute.
<div role="menu">
<button role="menuitem" aria-label="New file">
<img src="/test-assets/shared/file.svg" alt="" />
</button>
</div>This element with the menuitem role has an accessible name because its aria-labelledby attribute references an element with text content.
<div role="menu">
<button role="menuitem" aria-labelledby="newfile">
<img src="/test-assets/shared/file.svg" alt="" />
<span id="newfile" hidden>New file</span>
</button>
</div>This element with the menuitem role has an accessible name because of its title attribute.
<div role="menu">
<button role="menuitem" title="New file">
<img src="/test-assets/shared/file.svg" alt="" />
</button>
</div>This element with the menuitem role has no accessible name because it has no content or attribute that can provide it.
<div role="menu">
<button role="menuitem">
<img src="/test-assets/shared/file.svg" alt="" />
</button>
</div>This off-screen element with the menuitem role has no accessible name because it has no content or attribute that can provide it.
<html lang="en">
<style>
.offscreen {
position: absolute;
left: -9999px;
top: -9999px;
}
</style>
<div role="menu" class="offscreen">
<button role="menuitem">
<img src="/test-assets/shared/file.svg" alt="" />
</button>
</div>
</html>The li element has a listitem semantic role, even as a child of a menu element.
<menu>
<li>
<a href="#">New file</a>
</li>
</menu>This element with the menuitem role does not need an accessible name because it is not included in the accessibility tree.
<div role="menu" hidden>
<button role="menuitem">
<img src="/test-assets/shared/file.svg" alt="" />
</button>
</div>