Learning object 54 of 100
Accessible interaction laboratory
Operate tabs, an accordion and a form with mouse and keyboard, and watch the state, the ARIA attributes, the focus and the announcements update together.
Loading…
What it shows
Interactive components must tell assistive technology what they are and what state they are in. Native buttons already work with Enter and Space. aria-expanded, aria-selected and aria-pressed describe state; aria-describedby and aria-invalid connect error messages to fields; live regions announce changes; and focus should move to where the person needs to act next.
Guided experiment
- In Tabs, use the arrow keys after clicking a tab. Watch aria-selected and focus.
- In Accordion, open a section and read aria-expanded in the console.
- In Form errors, press Join with an empty field. Where does focus go?
Predict
Which attribute tells a screen reader that an accordion section is open?
Related
Lessons: Lesson 60: Building interactive components, Lesson 65: Accessible form feedback
Projects: Project 9: Shopping Cart Price Calculator
Source: web/assets/js/objects/object-054.js in the companion repository.