Test cases: 10 passing, 15 failing (25 total)
This page contains various button elements to test accessible name computation according to WCAG guidelines.
This button has visible text content that provides its accessible name.
<button id="btn-text-pass" class="a11yTestPass">Submit Form</button>
This button has both an icon and text, which together form its accessible name.
<button id="btn-icon-text-pass" class="a11yTestPass"><span>⭐</span> Add to Favorites</button>
This button has an aria-label attribute that provides its accessible name.
<button id="btn-aria-label-pass" class="a11yTestPass" aria-label="Close dialog">X</button>
This button uses aria-labelledby to reference text elsewhere on the page for its accessible name.
Search database<span id="search-label">Search database</span>
<button id="btn-aria-labelledby-pass" class="a11yTestPass" aria-labelledby="search-label">🔍</button>
This input type="button" uses its value attribute as the accessible name.
<input id="input-btn-value-pass" class="a11yTestPass" type="button" value="Click Me">
This reset button uses its value attribute as the accessible name.
<input id="reset-btn-value-pass" class="a11yTestPass" type="reset" value="Reset Form">
This button has no text content or accessible name.
<button id="btn-empty-fail" class="a11yTestFail"></button>
This button has only an icon but no accessible name.
<button id="btn-icon-only-fail" class="a11yTestFail icon-button" >❌</button>
This input button has no value attribute to provide an accessible name.
<input id="input-btn-no-value-fail" class="a11yTestFail" type="button">
This button has text that doesn't describe its function or purpose.
<button id="btn-generic-text-fail" class="a11yTestFail">Click</button>
This button has an empty aria-label attribute.
<button id="btn-empty-arialabel-fail" class="a11yTestFail" aria-label="">Save</button>
This button has an aria-labelledby attribute pointing to an ID that doesn't exist.
<button id="btn-broken-labelledby-fail" class="a11yTestFail" aria-labelledby="non-existent-id">Submit</button>
This button contains only whitespace characters, which doesn't provide a proper accessible name.
<button id="btn-whitespace-fail" class="a11yTestFail"> </button>
This button's aria-label contains only punctuation, which may not be announced by some screen readers.
<button id="btn-punctuation-arialabel-fail" class="a11yTestFail" aria-label="..."></button>
The following tests use <div role="button"> instead of semantic button elements.
This div with role="button" has visible text content that provides its accessible name.
<div id="aria-btn-text-pass" class="a11yTestPass" role="button" tabindex="0">Submit Form</div>
This div with role="button" has both an icon and text, which together form its accessible name.
<div id="aria-btn-icon-text-pass" class="a11yTestPass" role="button" tabindex="0"><span>⭐</span> Add to Favorites</div>
This div with role="button" has an aria-label attribute that provides its accessible name.
<div id="aria-btn-arialabel-pass" class="a11yTestPass" role="button" tabindex="0" aria-label="Close dialog">X</div>
This div with role="button" uses aria-labelledby to reference text elsewhere on the page for its accessible name.
Search database<span id="search-label-aria">Search database</span>
<div id="aria-btn-labelledby-pass" class="a11yTestPass" role="button" tabindex="0" aria-labelledby="search-label-aria">🔍</div>
This div with role="button" has no text content or accessible name.
<div id="aria-btn-empty-fail" class="a11yTestFail" role="button" tabindex="0"></div>
This div with role="button" has only an icon but no accessible name.
<div id="aria-btn-icon-only-fail" class="a11yTestFail icon-button" role="button" tabindex="0" >❌</div>
This div with role="button" has text that doesn't describe its function or purpose.
<div id="aria-btn-generic-text-fail" class="a11yTestFail" role="button" tabindex="0">Click</div>
This div with role="button" has an empty aria-label attribute.
<div id="aria-btn-empty-arialabel-fail" class="a11yTestFail" role="button" tabindex="0" aria-label="">Save</div>
This div with role="button" has an aria-labelledby attribute pointing to an ID that doesn't exist.
<div id="aria-btn-broken-labelledby-fail" class="a11yTestFail" role="button" tabindex="0" aria-labelledby="non-existent-id-aria">Submit</div>
This div with role="button" contains only whitespace characters, which doesn't provide a proper accessible name.
<div id="aria-btn-whitespace-fail" class="a11yTestFail" role="button" tabindex="0"> </div>
This div with role="button" has an aria-label with only punctuation, which may not be announced by some screen readers.
<div id="aria-btn-punctuation-arialabel-fail" class="a11yTestFail" role="button" tabindex="0" aria-label="..."></div>