Learn / TypeScript and React Product Systems
Accessibility and Error Recovery
Design UI flows that announce state changes, preserve focus, recover from failure, and stay usable on mobile.
Course: TypeScript and React Product Systems. Level: Intermediate. Topic: Frontend systems.
Stage: pro - Pro recovery and accessibility - Accessible recovery paths. Turn failure and recovery into a first-class product workflow with announcements, focus, and audit evidence.
Outcomes
- Connect labels, descriptions, and live regions.
- Restore focus after destructive or async actions.
- Design retry paths for failed optimistic updates.
Concepts
- aria-describedby
- live region
- focus management
- retry state
Concept flow
Show how accessible recovery paths moves from trigger to implementation outcome in TypeScript React.
- User action
- Pending UI
- Error state
- Focus target
- Retry action
Session flow
- Model aria-describedby (concept, 11 min) — Name the decisions behind aria-describedby before writing code.
- Connect labels, descriptions, and live regions.
- Explain where aria-describedby belongs in learning analytics dashboard.
- Build the vertical slice (walkthrough, 19 min) — Implement the smallest useful slice in components/AsyncActionPanel.tsx.
- Restore focus after destructive or async actions.
- Connect live region to a working example.
- Verify and harden (exercise, 13 min) — Test the flow with keyboard-only navigation.
- Design retry paths for failed optimistic updates.
- Record one risk or follow-up before moving on.
Code example
TSX in components/AsyncActionPanel.tsx.
function AsyncActionPanel({ error, retry }: Props) {
const statusId = useId();
return (
<section aria-describedby={statusId}>
<p id={statusId} role="status" aria-live="polite">
{error ? "Save failed. Review the issue and retry." : "Ready"}
</p>
{error && <button onClick={retry}>Retry save</button>}
</section>
);
}
Walkthrough examples
- Accessibility and Error Recovery in a learning analytics dashboard — A team is extending a resilient React product surface and needs this lesson's pattern to be clear enough for review, testing, and future maintenance.
- File: components/AsyncActionPanel.tsx
- File: tests/accessibility-and-error-recovery.spec
- File: docs/typescript-react/accessibility-and-error-recovery.md
- Start from the provided TSX snippet and make the intent visible in names and boundaries.
- Apply the checklist item "Every input has a label" before adding extra behavior.
- Write down how the implementation changes when live region fails or becomes slow.
Practice
- Add a live status to one async action.
- Move focus to the first useful recovery control after failure.
- Test the flow with keyboard-only navigation.
Checklist
- Every input has a label
- Async result is announced
- Retry path is visible
- Mobile tap targets fit
Quiz prompts
- Why should an async failure announce itself and expose a retry control? — Accessible recovery means the user can perceive the failure, understand it, and take the next action without hunting.
- A teammate wants to hide aria-describedby inside a convenient helper. What should you check first? — Place aria-describedby at the boundary that keeps learning analytics dashboard behavior explicit, testable, and reviewable.
- Which artifact best proves this TypeScript React lesson is ready for review? — Production-ready learning needs evidence: a test, trace, command, screenshot, or log that catches the risk again.
- Pro recovery and accessibility: a teammate says the happy path works, but "Announced async states" is still implicit. What should you ask for before merging? — Announced async states belongs in the pro stage only when the decision is visible, testable, and tied to a realistic failure mode.
- A reviewer has five minutes to evaluate this pro TypeScript React slice. Which evidence is strongest? — Deliver a pro recovery audit: announced async states, focus restoration, retry evidence, and a keyboard-only review note.
Flashcards
- Pro recovery and accessibility: what decision does "Announced async states" force you to make? Use status regions and copy so loading, saving, failure, and success are perceivable. Evidence prompt: Add or verify one polite status region for a save or retry workflow.
- Pro recovery and accessibility: what decision does "Focus restoration" force you to make? Return focus to the right control or heading after modal, route, and error transitions. Evidence prompt: Write a focus restoration checklist for one recovery path and test it with keyboard only.
- Pro recovery and accessibility: what decision does "Recovery-path audit" force you to make? Review empty, loading, error, retry, and success states as one resilient journey. Evidence prompt: Capture the full recovery path as screenshots or test steps a teammate can follow.
- In TypeScript React, what should you remember about aria-describedby? aria-describedby matters here because it supports "Connect labels, descriptions, and live regions.".
- In TypeScript React, what should you remember about live region? live region matters here because it supports "Restore focus after destructive or async actions.".
- In TypeScript React, what should you remember about focus management? focus management matters here because it supports "Design retry paths for failed optimistic updates.".
- In TypeScript React, what should you remember about retry state? retry state matters here because it supports "Connect labels, descriptions, and live regions.".
Labs
- Ship a accessibility and error recovery slice — Extend a resilient React product surface with a small but reviewable feature that proves the lesson's architecture in code.
- Deliver a pro recovery audit: announced async states, focus restoration, retry evidence, and a keyboard-only review note.
- Add or verify one polite status region for a save or retry workflow.
- Write a focus restoration checklist for one recovery path and test it with keyboard only.
- Capture the full recovery path as screenshots or test steps a teammate can follow.
- Add a live status to one async action.
- Move focus to the first useful recovery control after failure.
- The lab demonstrates the pro recovery and accessibility outcome without skipping earlier contract evidence.
- Each subtopic has a concrete artifact: Announced async states, Focus restoration, Recovery-path audit.
- The review notes explain how this level changes ownership, verification, or operational risk.
Challenge
- Review-ready accessibility and error recovery (Core) — Deliver a pro recovery audit: announced async states, focus restoration, retry evidence, and a keyboard-only review note.
- All checklist items are either implemented or documented with a reason.
- The change can be understood from components/AsyncActionPanel.tsx plus one short note.
- The concept diagram names ownership, failure handling, and verification points.
- A teammate could run the verification steps without asking for hidden context.
Canonical lesson URL