Test accessible status announcements
Testing + Tooling Drills · Unit + Integration Tests
Verify labels, button states, focus movement, and live-region announcements across transfer state changes.
Prompt
Test accessible status announcements
This is a hands-on rep. Attempt the drill before reading the model answer, then narrate the tradeoffs as if an interviewer is watching.
Accessibility is part of correctness for stressful financial workflows.
What to ground before answering
Verify labels, button states, focus movement, and live-region announcements across transfer state changes.
Focus vocabulary: Testing Library, a11y, status UI.
The useful mental model is not to memorize a perfect answer. It is to explain what owns the data, what can fail, what the user sees, and what test would prove the behavior.
Derive accessible status announcements
Make the behavior executable before comparing against the model answer.
type TransferUiState = 'draft' | 'signing' | 'pending' | 'failed-retryable' | 'reconciled';
type Announcement = { role: 'status' | 'alert'; text: string; focusTarget?: string };
function statusAnnouncement(state: TransferUiState): Announcement {
// TODO: choose polite status vs urgent alert and focus targets.
return { role: 'status', text: '' };
}Interview explanation prompt
- What problem is this practice item really testing?
- What state or contract boundary must be explicit?
- What edge case would cause a production regression?
- What would you test first?
- How would you explain the tradeoff in two minutes?
Self-grade
- Strong answer handles the edge cases before polishing syntax.
- Strong answer explains why the chosen type or function boundary prevents bugs.
- Weak answer passes only the happy path or hides uncertainty in booleans and nullable fields.
Model Answer
function statusAnnouncement(state: TransferUiState): Announcement {
switch (state) {
case 'draft':
return { role: 'status', text: 'Transfer form ready' };
case 'signing':
return { role: 'status', text: 'Waiting for approval' };
case 'pending':
return { role: 'status', text: 'Transfer submitted and pending confirmation' };
case 'failed-retryable':
return { role: 'alert', text: 'Transfer needs attention', focusTarget: 'retry-button' };
case 'reconciled':
return { role: 'status', text: 'Transfer complete' };
}
}Recall before moving on
- What is the one-sentence answer for "Test accessible status announcements"?
- Which real experience from PR TIMES, React/TypeScript migration, or systems work supports it?
- What edge case would you volunteer before the interviewer asks?
- What is the smallest test or artifact that proves the design works?