Purpose
A disclosure widget allows users to show or hide a single section of content with a toggle button. Use it for supplementary information, filter panels, or expandable details.
Usage Guidance
- A single disclosure replaces the need for an accordion
- The button label should describe the hidden content
- Consider whether the content should be visible by default
Accessibility Considerations
- The trigger must be a
<button>witharia-expanded aria-controlson the button links it to the content panel- The content panel uses the
hiddenattribute when collapsed
Keyboard Support
| Key | Action |
|---|---|
Tab |
Move focus to the button |
Enter / Space |
Toggle the panel visibility |
Screen Reader Behavior
Screen readers announce the button label, “button”, and “expanded/collapsed” state. Users navigate into the revealed panel normally when open.
ARIA Requirements
aria-expanded="true|false"on the trigger<button>aria-controls="panel-id"on the trigger
Common Mistakes
- Using
aria-expandedon a non-button element - Forgetting to toggle the
hiddenattribute on the panel - Using
display:nonevia CSS instead of thehiddenattribute (both work, but be consistent)
Live Example
Preserve all accessibility audit records, testing evidence (screenshots, screen recordings, automated scan reports), accessibility policies, training records, VPATs, remediation tracking records, and any communications related to accessibility decisions. Consult legal counsel immediately to determine the full scope of your litigation hold.
Code Example
<button
type="button"
aria-expanded="false"
aria-controls="disclosure-content"
data-disclosure-trigger
>
Show more information
</button>
<div id="disclosure-content" hidden>
<!-- Content revealed when expanded -->
</div>
document.querySelectorAll('[data-disclosure-trigger]').forEach(function(btn) {
var panel = document.getElementById(btn.getAttribute('aria-controls'));
btn.addEventListener('click', function() {
var expanded = btn.getAttribute('aria-expanded') === 'true';
btn.setAttribute('aria-expanded', String(!expanded));
panel.hidden = expanded;
});
});