Keep dynamic behavior understandable to everyone.
- focus management
- status messages
- keyboard
- ARIA state
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.
Adding ARIA attributes without matching actual behavior can make the interface more confusing.
Create an expandable section with a button, visible focus, and synchronized state; test keyboard use.
Open example.html in a browser and edit example.js. Save, refresh, and use the Console and debugger to inspect values.
- 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.