This article is programmatically focusable but has no accessible name.
Test cases: 16 passing, 36 failing (52 total)
This page contains test cases for validating accessible names for various ARIA roles. Each role section provides passing and failing examples to help with accessible name computation testing.
These tests validate accessible names for elements with role="meter". Meters are used to represent scalar measurements with a known range.
According to the WAI-ARIA specification, the role="meter" represents a scalar measurement within a known range, similar to an HTML <meter> element. Key implementation requirements include:
aria-label or aria-labelledbyaria-valuemin, aria-valuemax, and aria-valuenow to communicate its valuesaria-valuetext can provide a human-readable text alternative of the valueImportant: While HTML provides a native <meter> element that should be used when possible, the ARIA meter role is needed when creating custom meter widgets or retrofitting existing elements.
This div with role="meter" has a descriptive aria-label providing an accessible name.
<div role="meter" id="meter-aria-label-pass" class="a11yTestPass" aria-label="Battery Level" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 75%; height: 100%; background-color: #4CAF50;"></div> </div> </div>
This div with role="meter" uses aria-labelledby to reference another element for its accessible name.
<h4 id="disk-usage-label">Disk Usage</h4> <div role="meter" id="meter-aria-labelledby-pass" class="a11yTestPass" aria-labelledby="disk-usage-label" aria-valuemin="0" aria-valuemax="100" aria-valuenow="65" aria-valuetext="65% used"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 65%; height: 100%; background-color: #2196F3;"></div> </div> </div>
This div with role="meter" lacks an accessible name, making it difficult for screen reader users to understand its purpose.
<div role="meter" id="meter-no-name-fail" class="a11yTestFail" aria-valuemin="0" aria-valuemax="100" aria-valuenow="30"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 30%; height: 100%; background-color: #FF9800;"></div> </div> </div>
This div with role="meter" has an empty aria-label, which provides no accessible name.
<div role="meter" id="meter-empty-label-fail" class="a11yTestFail" aria-label="" aria-valuemin="0" aria-valuemax="100" aria-valuenow="45"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 45%; height: 100%; background-color: #673AB7;"></div> </div> </div>
This div with role="meter" has an aria-label with only whitespace, which provides no accessible name.
<div role="meter" id="meter-whitespace-label-fail" class="a11yTestFail" aria-label=" " aria-valuemin="0" aria-valuemax="100" aria-valuenow="60"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 60%; height: 100%; background-color: #E91E63;"></div> </div> </div>
This div with role="meter" has an aria-label with only punctuation, which provides no meaningful accessible name.
<div role="meter" id="meter-punctuation-label-fail" class="a11yTestFail" aria-label="..." aria-valuemin="0" aria-valuemax="100" aria-valuenow="85"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 85%; height: 100%; background-color: #009688;"></div> </div> </div>
This div with role="meter" references a non-existent element ID with aria-labelledby, which prevents an accessible name from being created.
<div role="meter" id="meter-broken-labelledby-fail" class="a11yTestFail" aria-labelledby="non-existent-meter-id" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 50%; height: 100%; background-color: #795548;"></div> </div> </div>
This div with role="meter" references an element with no content via aria-labelledby, causing the accessible name computation to fail.
<span id="empty-meter-label"></span> <div role="meter" id="meter-empty-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="empty-meter-label" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 25%; height: 100%; background-color: #F44336;"></div> </div> </div>
This div with role="meter" references an element that has only whitespace via aria-labelledby, causing the accessible name computation to fail.
<span id="whitespace-meter-label"> </span> <div role="meter" id="meter-whitespace-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="whitespace-meter-label" aria-valuemin="0" aria-valuemax="100" aria-valuenow="90"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 90%; height: 100%; background-color: #3F51B5;"></div> </div> </div>
This div with role="meter" references an element that has only punctuation via aria-labelledby, causing the accessible name computation to fail.
...<span id="punctuation-meter-label">...</span> <div role="meter" id="meter-punctuation-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="punctuation-meter-label" aria-valuemin="0" aria-valuemax="100" aria-valuenow="40"> <div style="width: 200px; height: 20px; background-color: #eee; border-radius: 10px; overflow: hidden;"> <div style="width: 40%; height: 100%; background-color: #00BCD4;"></div> </div> </div>
These tests validate accessible names for elements with role="toolbar". Toolbars are containers for groups of buttons or other interactive controls.
According to the WAI-ARIA Authoring Practices Guide (APG), the role="toolbar" is a container for grouping a set of commonly used controls. Key implementation requirements include:
aria-label or aria-labelledbyaria-orientation to indicate its orientation (horizontal by default)role="group" with proper labelingImportant: A toolbar is different from a menubar in that it is always visible and contains buttons, while a menubar contains dropdown menus. Toolbars are commonly used in document editing software, drawing applications, and other interfaces with many user actions.
This div with role="toolbar" has a descriptive aria-label providing an accessible name.
<div role="toolbar" id="toolbar-aria-label-pass" class="a11yTestPass" aria-label="Text Formatting" aria-orientation="horizontal"> <button aria-pressed="false" type="button">Bold</button> <button aria-pressed="false" type="button">Italic</button> <button aria-pressed="false" type="button">Underline</button> <span role="separator"></span> <button type="button">Left</button> <button type="button">Center</button> <button type="button">Right</button> </div>
This div with role="toolbar" uses aria-labelledby to reference another element for its accessible name.
<h4 id="drawing-tools-label">Drawing Tools</h4> <div role="toolbar" id="toolbar-aria-labelledby-pass" class="a11yTestPass" aria-labelledby="drawing-tools-label" aria-orientation="horizontal"> <div role="group" aria-label="Shapes"> <button type="button">Rectangle</button> <button type="button">Circle</button> <button type="button">Line</button> </div> <span role="separator"></span> <div role="group" aria-label="Colors"> <button type="button">Red</button> <button type="button">Green</button> <button type="button">Blue</button> </div> </div>
This div with role="toolbar" lacks an accessible name, making it difficult for screen reader users to understand its purpose.
<div role="toolbar" id="toolbar-no-name-fail" class="a11yTestFail" aria-orientation="horizontal"> <button type="button">Cut</button> <button type="button">Copy</button> <button type="button">Paste</button> <span role="separator"></span> <button type="button">Delete</button> </div>
This div with role="toolbar" has an empty aria-label, which provides no accessible name.
<div role="toolbar" id="toolbar-empty-label-fail" class="a11yTestFail" aria-label="" aria-orientation="horizontal"> <button type="button">New</button> <button type="button">Open</button> <button type="button">Save</button> <span role="separator"></span> <button type="button">Print</button> </div>
This div with role="toolbar" has an aria-label with only whitespace, which provides no accessible name.
<div role="toolbar" id="toolbar-whitespace-label-fail" class="a11yTestFail" aria-label=" " aria-orientation="horizontal"> <button type="button">Undo</button> <button type="button">Redo</button> <span role="separator"></span> <button type="button">Find</button> <button type="button">Replace</button> </div>
This div with role="toolbar" has an aria-label with only punctuation, which provides no meaningful accessible name.
<div role="toolbar" id="toolbar-punctuation-label-fail" class="a11yTestFail" aria-label="..." aria-orientation="horizontal"> <button type="button">Zoom In</button> <button type="button">Zoom Out</button> <button type="button">Fit</button> <span role="separator"></span> <button type="button">Fullscreen</button> </div>
This div with role="toolbar" references a non-existent element ID with aria-labelledby, which prevents an accessible name from being created.
<div role="toolbar" id="toolbar-broken-labelledby-fail" class="a11yTestFail" aria-labelledby="non-existent-toolbar-id" aria-orientation="vertical"> <button type="button">Insert Image</button> <button type="button">Insert Table</button> <button type="button">Insert Chart</button> <span role="separator"></span> <button type="button">Insert Link</button> </div>
This div with role="toolbar" references an element with no content via aria-labelledby, causing the accessible name computation to fail.
<span id="empty-toolbar-label"></span> <div role="toolbar" id="toolbar-empty-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="empty-toolbar-label" aria-orientation="horizontal"> <button type="button">Page Setup</button> <button type="button">Margins</button> <button type="button">Orientation</button> <span role="separator"></span> <button type="button">Size</button> </div>
This div with role="toolbar" references an element that has only whitespace via aria-labelledby, causing the accessible name computation to fail.
<span id="whitespace-toolbar-label"> </span> <div role="toolbar" id="toolbar-whitespace-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="whitespace-toolbar-label" aria-orientation="horizontal"> <button type="button">Bullets</button> <button type="button">Numbering</button> <button type="button">Indent</button> <button type="button">Outdent</button> </div>
This div with role="toolbar" references an element that has only punctuation via aria-labelledby, causing the accessible name computation to fail.
...<span id="punctuation-toolbar-label">...</span> <div role="toolbar" id="toolbar-punctuation-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="punctuation-toolbar-label" aria-orientation="horizontal"> <button type="button">Header</button> <button type="button">Footer</button> <span role="separator"></span> <button type="button">Date</button> <button type="button">Time</button> </div>
These tests validate accessible names for elements with role="tree" and role="treeitem". Trees are hierarchical lists that allow users to navigate through and select nested content.
According to the WAI-ARIA Authoring Practices Guide (APG), a role="tree" represents a hierarchical list with nested groups that can be collapsed and expanded. Key implementation requirements include:
aria-label or aria-labelledbyrole="treeitem"aria-expanded to indicate their statearia-level, aria-setsize, and aria-posinset to define its position in the hierarchyImportant: Trees are often used for navigation menus, file systems, site maps, or other hierarchical data structures where users need to navigate through multiple levels of information.
This div with role="tree" has a descriptive aria-label providing an accessible name.
<div role="tree" id="tree-aria-label-pass" class="a11yTestPass" aria-label="File Explorer" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Documents <div role="group"> <div role="treeitem" aria-level="2">Reports</div> <div role="treeitem" aria-expanded="true" aria-level="2">Projects <div role="group"> <div role="treeitem" aria-level="3">Project A</div> <div role="treeitem" aria-level="3">Project B</div> </div> </div> <div role="treeitem" aria-level="2">Presentations</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Pictures</div> <div role="treeitem" aria-expanded="false" aria-level="1">Music</div> </div>
This div with role="tree" uses aria-labelledby to reference another element for its accessible name.
<h4 id="site-structure-label">Site Structure</h4> <div role="tree" id="tree-aria-labelledby-pass" class="a11yTestPass" aria-labelledby="site-structure-label" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Home <div role="group"> <div role="treeitem" aria-level="2">About Us</div> <div role="treeitem" aria-expanded="true" aria-level="2">Products <div role="group"> <div role="treeitem" aria-level="3">Hardware</div> <div role="treeitem" aria-level="3">Software</div> <div role="treeitem" aria-level="3">Services</div> </div> </div> <div role="treeitem" aria-level="2">Contact</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Blog</div> <div role="treeitem" aria-expanded="false" aria-level="1">Support</div> </div>
This div with role="treeitem" has a descriptive aria-label providing an accessible name that enhances the default text content.
<div role="tree" aria-label="Organization Chart"> <div role="treeitem" id="treeitem-aria-label-pass" class="a11yTestPass" aria-label="Executive Team (7 members)" aria-expanded="true" aria-level="1">Executive Team <div role="group"> <div role="treeitem" aria-level="2">CEO</div> <div role="treeitem" aria-level="2">CFO</div> <div role="treeitem" aria-level="2">CTO</div> </div> </div> </div>
This div with role="tree" lacks an accessible name, making it difficult for screen reader users to understand its purpose.
<div role="tree" id="tree-no-name-fail" class="a11yTestFail" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Categories <div role="group"> <div role="treeitem" aria-level="2">Electronics</div> <div role="treeitem" aria-level="2">Clothing</div> <div role="treeitem" aria-level="2">Home & Garden</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Brands</div> <div role="treeitem" aria-expanded="false" aria-level="1">Deals</div> </div>
This div with role="tree" has an empty aria-label, which provides no accessible name.
<div role="tree" id="tree-empty-label-fail" class="a11yTestFail" aria-label="" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Departments <div role="group"> <div role="treeitem" aria-level="2">HR</div> <div role="treeitem" aria-level="2">Finance</div> <div role="treeitem" aria-level="2">Engineering</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Teams</div> <div role="treeitem" aria-expanded="false" aria-level="1">Locations</div> </div>
This div with role="tree" has an aria-label with only whitespace, which provides no accessible name.
<div role="tree" id="tree-whitespace-label-fail" class="a11yTestFail" aria-label=" " tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Years <div role="group"> <div role="treeitem" aria-level="2">2023</div> <div role="treeitem" aria-level="2">2024</div> <div role="treeitem" aria-level="2">2025</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Quarters</div> <div role="treeitem" aria-expanded="false" aria-level="1">Months</div> </div>
This div with role="tree" has an aria-label with only punctuation, which provides no meaningful accessible name.
<div role="tree" id="tree-punctuation-label-fail" class="a11yTestFail" aria-label="..." tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Settings <div role="group"> <div role="treeitem" aria-level="2">General</div> <div role="treeitem" aria-level="2">Security</div> <div role="treeitem" aria-level="2">Advanced</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Themes</div> <div role="treeitem" aria-expanded="false" aria-level="1">Extensions</div> </div>
This div with role="tree" references a non-existent element ID with aria-labelledby, which prevents an accessible name from being created.
<div role="tree" id="tree-broken-labelledby-fail" class="a11yTestFail" aria-labelledby="non-existent-tree-id" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Folders <div role="group"> <div role="treeitem" aria-level="2">Inbox</div> <div role="treeitem" aria-level="2">Sent</div> <div role="treeitem" aria-level="2">Drafts</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Labels</div> <div role="treeitem" aria-expanded="false" aria-level="1">Archive</div> </div>
This div with role="tree" references an element with no content via aria-labelledby, causing the accessible name computation to fail.
<span id="empty-tree-label"></span> <div role="tree" id="tree-empty-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="empty-tree-label" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Projects <div role="group"> <div role="treeitem" aria-level="2">Active</div> <div role="treeitem" aria-level="2">Completed</div> <div role="treeitem" aria-level="2">Archived</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Tasks</div> <div role="treeitem" aria-expanded="false" aria-level="1">Team</div> </div>
This div with role="tree" references an element that has only whitespace via aria-labelledby, causing the accessible name computation to fail.
<span id="whitespace-tree-label"> </span> <div role="tree" id="tree-whitespace-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="whitespace-tree-label" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Components <div role="group"> <div role="treeitem" aria-level="2">Buttons</div> <div role="treeitem" aria-level="2">Forms</div> <div role="treeitem" aria-level="2">Cards</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Layouts</div> <div role="treeitem" aria-expanded="false" aria-level="1">Utilities</div> </div>
This div with role="tree" references an element that has only punctuation via aria-labelledby, causing the accessible name computation to fail.
...<span id="punctuation-tree-label">...</span> <div role="tree" id="tree-punctuation-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="punctuation-tree-label" tabindex="0"> <div role="treeitem" aria-expanded="true" aria-level="1">Chapters <div role="group"> <div role="treeitem" aria-level="2">Introduction</div> <div role="treeitem" aria-level="2">Chapter 1</div> <div role="treeitem" aria-level="2">Chapter 2</div> </div> </div> <div role="treeitem" aria-expanded="false" aria-level="1">Appendix</div> <div role="treeitem" aria-expanded="false" aria-level="1">References</div> </div>
This div with role="treeitem" has an empty aria-label, which overrides its text content and provides no accessible name.
<div role="tree" aria-label="Project Structure"> <div role="treeitem" id="treeitem-empty-label-fail" class="a11yTestFail" aria-label="" aria-expanded="true" aria-level="1">Source Code <div role="group"> <div role="treeitem" aria-level="2">src</div> <div role="treeitem" aria-level="2">lib</div> <div role="treeitem" aria-level="2">tests</div> </div> </div> </div>
These tests validate accessible names for elements that use tabindex to make them focusable, even when the ARIA role is incorrect or non-interactive. This tests whether screen readers can announce something meaningful when focusing these elements.
When elements have tabindex="0" or tabindex="-1", they become programmatically focusable, which means screen readers may announce them. Having an accessible name for these elements is important even if the role is incorrect or non-standard:
tabindex="0" adds the element to the tab sequence, allowing users to focus it with keyboard navigationtabindex="-1" makes the element programmatically focusable but not in the tab sequence (usually for focus management)Important: While these tests validate accessible name computation, they do NOT represent best practices for ARIA usage. In production code, always use the correct ARIA roles that match the element's purpose and behavior.
This div has a non-interactive role but is in the tab sequence and has an accessible name.
<div role="separator" tabindex="0" id="tabindex-0-aria-label-pass" class="a11yTestPass" aria-label="Section Divider"> <hr> </div>
This div has a non-interactive role but is programmatically focusable and has an accessible name.
<div role="img" tabindex="-1" id="tabindex-n1-aria-label-pass" class="a11yTestPass" aria-label="Decorative Background"> <div style="width: 200px; height: 30px; background-color: #f5f5f5;"></div> </div>
This div has a non-interactive role but is in the tab sequence and gets its accessible name from another element.
This section contains critical information about the system.
<h4 id="section-heading">Important Information</h4> <div role="region" tabindex="0" id="tabindex-0-aria-labelledby-pass" class="a11yTestPass" aria-labelledby="section-heading"> <p>This section contains critical information about the system.</p> </div>
This div uses an invalid ARIA role but has tabindex="-1" and an accessible name.
This element has an invalid role but is still programmatically focusable.
<div role="not-a-real-role" tabindex="-1" id="invalid-role-with-name-pass" class="a11yTestPass" aria-label="Custom Element"> <p>This element has an invalid role but is still programmatically focusable.</p> </div>
This div is in the tab sequence but lacks an accessible name, making it unclear to screen reader users what they're focusing on.
This group is focusable but has no accessible name.
<div role="group" tabindex="0" id="tabindex-0-no-name-fail"> <p>This group is focusable but has no accessible name.</p> </div>
This div is programmatically focusable but lacks an accessible name, making it unclear to screen reader users what they're focusing on.
This region is programmatically focusable but has no accessible name.
<div role="region" tabindex="-1" id="tabindex-n1-no-name-fail"> <p>This region is programmatically focusable but has no accessible name.</p> </div>
This div is in the tab sequence but has an empty aria-label, providing no accessible name.
This element has no semantic role but is focusable with an empty accessible name.
<div role="none" tabindex="0" id="tabindex-0-empty-label-fail" class="a11yTestFail" aria-label=""> <p>This element has no semantic role but is focusable with an empty accessible name.</p> </div>
This div is programmatically focusable but has an aria-label with only whitespace, providing no accessible name.
This element has a presentation role but is focusable with a whitespace-only accessible name.
<div role="presentation" tabindex="-1" id="tabindex-n1-whitespace-label-fail" class="a11yTestFail" aria-label=" "> <p>This element has a presentation role but is focusable with a whitespace-only accessible name.</p> </div>
This div is in the tab sequence but has an aria-label with only punctuation, providing no meaningful accessible name.
This status region is focusable but has a punctuation-only accessible name.
<div role="status" tabindex="0" id="tabindex-0-punctuation-label-fail" class="a11yTestFail" aria-label="..."> <p>This status region is focusable but has a punctuation-only accessible name.</p> </div>
This div is programmatically focusable but references a non-existent element ID with aria-labelledby, preventing an accessible name from being created.
This complementary section is focusable but has a broken aria-labelledby reference.
<div role="complementary" tabindex="-1" id="tabindex-n1-broken-labelledby-fail" class="a11yTestFail" aria-labelledby="non-existent-label-id"> <p>This complementary section is focusable but has a broken aria-labelledby reference.</p> </div>
This div is in the tab sequence but references an element with no content via aria-labelledby, causing the accessible name computation to fail.
This contentinfo section is focusable but has an empty aria-labelledby reference.
<span id="empty-tabindex-label"></span> <div role="contentinfo" tabindex="0" id="tabindex-0-empty-reference-labelledby-fail" class="a11yTestFail" aria-labelledby="empty-tabindex-label"> <p>This contentinfo section is focusable but has an empty aria-labelledby reference.</p> </div>
This article element is programmatically focusable but lacks an accessible name.
This article is programmatically focusable but has no accessible name.
<article tabindex="-1" id="native-element-tabindex-n1-no-name-fail"> <p>This article is programmatically focusable but has no accessible name.</p> </article>