Expand / Collapse Widget

Accessible examples of an expand/collapse widget. Each widget is wrapped in a div.example; the controlled content container uses the class "details".

This widget starts open. The script initializes state based on aria-expanded so this content is visible on load.
Example of an initially-open widget.