Skip to content

SC2-5-3-label-content-name-mismatch #104

@annethyme

Description

@annethyme

name: label and name from content mismatch
description: |
Interactive elements labelled through their content must have their visible label as part of their accessible name

success_criterion:

  • 2.5.3 # Label in Name

test_aspects:

  • DOM Tree
  • CSS Styling

authors:

  • Anne Thyme Nørregaard
  • Bryn Anderson
  • Jey Nandakumar
  • Wilco Fiers

Test procedure

Applicability

This rule applies to any element that has:

Note: At time of writing this rule, the widget roles that supports name from content are: button, checkbox, gridcell, link, menuitem, menuitemcheckbox, menuitemradio, option, radio, searchbox, switch, tab, treeitem.

Expectation 1

The complete visible text content of the target element either matches or is contained within it's accessible name. Leading and trailing whitespace and difference in case sensitivity should be ignored.

Assumptions

There are currently no assumptions

Accessibility Support

There are no major accessibility support issues known for this rule.

Background

Test cases

Passed

<!-- Visible label and accessible name matches when trailing white spaces are removed -->
<div role="link" aria-label="next page ">next page</div>
<!-- Character insensitivity between visible label and accessible name -->
<div role="link" aria-label="Next Page">next page</div>
<!-- Full visible label is contained in the accessible name -->
<button name="link" aria-label="Next Page in the list">Next Page</div>

Failed

<!-- Visible label doesn't match accessible name -->
<div role="link" aria-label="OK">Next</a>
<!-- Not all of visible label is included in accessible name -->
<button name="link" aria-label="the full">The full label</div>

Inapplicable

<!-- Not a widget role -->
<a aria-label="OK">Next</a>
<!-- Widget role that does not support name from content -->
<input type="email" aria-label="E-mail">Contact</input>
<!-- Non-widget role that supports name from content -->
<div role="tooltip" aria-label="OK">Next</a>
<!-- No rendered text in name from content -->
<div role="tooltip" aria-label="OK"></a>
<!-- Non-text content -->
<button aria-label="close">X</button>

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions