ARIA state indicating whether a collapsible element is currently expanded (true) or collapsed (false).
aria-expanded is an ARIA state attribute that indicates whether a collapsible element is currently expanded or collapsed. It's essential for any interface element that shows or hides content – dropdowns, accordions, menus, and disclosure widgets.
This attribute serves as a communication bridge between your interface and assistive technology users. When a screen reader encounters a button with aria-expanded="false", it announces that there's hidden content available. When aria-expanded="true", users know content is currently visible.
According to WebAIM's widget analysis (2023), 58% of expandable components fail to implement aria-expanded correctly, leaving screen reader users guessing about content availability and state. This isn't just a technical oversight – it breaks the fundamental user expectation that interfaces communicate their current state clearly.
aria-expanded requires careful implementation to work correctly across all assistive technologies:
Basic Dropdown Menu: ```html
```
Accordion Panel: ```html
Content goes here...
Navigation Menu: ```html ```
Critical Implementation Rules: - Always update aria-expanded when content visibility changes - Use "true" and "false" strings, not boolean values - Pair with aria-controls to identify what's being expanded - Ensure the controlled element actually shows/hides when state changes
These implementation errors appear frequently and confuse assistive technology users:
Static aria-expanded Values: ```html
```
Boolean Instead of String Values: ```javascript // WRONG: Boolean values don't work reliably button.setAttribute('aria-expanded', true);
// RIGHT: String values work across all browsers button.setAttribute('aria-expanded', 'true'); ```
Missing aria-controls Relationship: ```html
Inconsistent Visual and ARIA States: ```css /* WRONG: CSS and ARIA state don't match */ .dropdown[aria-expanded="false"] .menu { display: block; } /* Visible but ARIA says collapsed */
/* RIGHT: CSS reflects ARIA state */ .dropdown[aria-expanded="false"] .menu { display: none; } .dropdown[aria-expanded="true"] .menu { display: block; } ```
Framework State Management Issues: In React, Vue, or Angular, ensure aria-expanded updates when component state changes, not just on initial render.
aria-expanded testing requires both automated validation and user experience verification:
Automated Testing: ```javascript // Validate aria-expanded implementation function validateAriaExpanded() { const expandableElements = document.querySelectorAll('[aria-expanded]'); const issues = []; expandableElements.forEach(element => { const expanded = element.getAttribute('aria-expanded'); const controls = element.getAttribute('aria-controls'); // Check for valid values if (expanded !== 'true' && expanded !== 'false') { issues.push({ element, issue: 'aria-expanded must be "true" or "false"', value: expanded }); } // Check for aria-controls relationship if (!controls) { issues.push({ element, issue: 'Missing aria-controls attribute', recommendation: 'Add aria-controls pointing to controlled element ID' }); } else { const controlledElement = document.getElementById(controls); if (!controlledElement) { issues.push({ element, issue: 'aria-controls points to non-existent element', value: controls }); } } }); return issues; } ```
Screen Reader Testing Process: 1. Navigate to expandable element with screen reader 2. Listen to initial announcement (should include "collapsed" or "expanded") 3. Activate element (Enter or Space) 4. Verify state change is announced 5. Check that controlled content is accessible 6. Test with NVDA, JAWS, and VoiceOver
Manual Testing Checklist: - Does aria-expanded accurately reflect visual state? - Are state changes announced when toggling? - Can users understand what will be expanded/collapsed? - Does keyboard navigation work as expected? - Is focus managed appropriately when content appears/disappears?
Performance Impact: Proper aria-expanded implementation improves screen reader efficiency by 23% compared to unlabeled expandable content (WebAbility performance data, 2023).
WebAbility provides comprehensive aria-expanded implementation and optimization across all expandable content patterns:
Automated State Management: - Detects expandable content patterns and adds proper aria-expanded attributes - Ensures aria-expanded values update correctly when content visibility changes - Validates aria-controls relationships and fixes broken ID references - Implements proper keyboard navigation for expandable components - Monitors dynamic content for consistent aria-expanded behavior
Framework Integration: - React, Vue, and Angular component libraries with built-in aria-expanded management - State synchronization between component state and ARIA attributes - Automated testing for aria-expanded consistency across component lifecycles - Development tools for real-time aria-expanded validation - Best practices guidance for framework-specific expandable component patterns
Quality Assurance and Testing: - Screen reader testing with multiple assistive technologies for aria-expanded announcements - Keyboard navigation testing for expandable component accessibility - Performance testing for aria-expanded state management efficiency - User testing with people who rely on expandable content state information - Cross-browser testing for consistent aria-expanded behavior
WebAbility ensures your expandable content communicates clearly with all users, creating predictable and accessible interface patterns that enhance usability for everyone.
Join over 1 million websites using WebAbility to ensure digital accessibility compliance and provide equal access to all users.
The computed name exposed to assistive technologies for an element, derived from label, aria-label, aria-labelledby, or text content.
Supplemental help text associated with an element, often via aria-describedby, that provides additional guidance beyond the accessible name.
An area of the page that notifies assistive technologies about dynamic updates. Use sparingly with polite or assertive announcements.
Text associated with an input that communicates its purpose. Implement with <label for> or ARIA labelling.
Page sections identified by semantic elements or ARIA roles (main, navigation, complementary, banner, contentinfo) for quick navigation.
This glossary is continuously improved and maintained by WebAbility to advance accessible design and development.Contact us to suggest improvements or report issues.