R247 Give a control that opens or folds a part aria-expanded and aria-controls

On by default

Give every control on a page that opens or folds another part of it aria-expanded, saying whether that part is open, and aria-controls, naming that part.

Reason

Without them a screen reader announces only a button, and its user cannot tell that the button opens anything, or whether it is open; the page then costs them a try to find out what it would have told them at once (Art. III).

Verification

Opening or folding a part covers showing and hiding it: a menu, a popover, a panel, a group of a list. The summary of a details element says this itself and needs neither attribute. aria-expanded follows the state: it changes when the part opens or folds.

Violated when a change adds or changes such a control, other than a summary, without an aria-expanded that follows the part’s state, or without an aria-controls that names the part.

Provisions of the constitution it cites

Relations

Parent
R240 Frontend
Requires
none
Conflicts with
none

Metadata

ID
247
Revision
1
Kind
rule
Status
trial
Slug
frontend-expanded-state
Default level
project
Constitution revisions
>=1
Check
none
Default
on
Uses
Instructions instructions, Review review
Original language
English en
Translations
Chinese zh