Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.11 KB

File metadata and controls

38 lines (25 loc) · 1.11 KB

51. Accessibility in scripted UI

Keep dynamic behavior understandable to everyone.

Learn

  • focus management
  • status messages
  • keyboard
  • ARIA state

How it works

JavaScript can change content and state, but the semantics and focus path must stay coherent. Prefer native controls and update attributes such as aria-expanded only when they accurately reflect behavior. Status text may need an appropriate live region for important asynchronous feedback. Test with keyboard and an accessibility tree.

Common mistake

Adding ARIA attributes without matching actual behavior can make the interface more confusing.

Guided challenge

Create an expandable section with a button, visible focus, and synchronized state; test keyboard use.

Run the example

Open example.html in a browser and edit example.js. Save, refresh, and use the Console and debugger to inspect values.

Completion check

  • Explain the core idea in your own words without reading the code.
  • Change one input and predict the output before running it.
  • Test one boundary or failure case, then record what you changed.