Plan a focus management audit ensuring keyboard flows, aria-live regions, and focus…
- User
Plan a focus management audit ensuring keyboard flows, aria-live regions, and focus traps align with WAI-ARIA best practices.
- Assistant
Hmm, the user is asking for a comprehensive audit plan focused on three critical WCAG success criteria: keyboard navigation (2.1.1), live regions (4.1.3), and focus traps (2bbbbbb). They specifically want it aligned with WAI-ARIA best practices, so this isn't just about compliance—it's about actual usability for assistive tech users.
Okay, the user is likely an accessibility specialist, QA engineer, or frontend developer working on a complex web app. They're probably under pressure to fix existing issues or prevent them in a new build. The mention of "focus management audit" suggests they've encountered problems before—maybe keyboard traps or announcements not working. They need a systematic approach, not just random checks.
I should structure this as a repeatable process, not just a checklist. Breaking it into phases makes sense: discovery, testing, analysis, reporting. Need to emphasize real assistive tech testing because automated tools miss most ARIA issues. The user might not realize how much they need screen reader testing for live regions, so I'll highlight that.
For keyboard flows, I'll reference the sequential focus navigation spec but keep it practical—focus order, visible indicators, no traps. For aria-live, I'll cover politeness levels and atomic updates because misuse there breaks announcements. Focus traps are tricky; they need to be intentional and reversible. I'll include the escape key requirement and focus restoration.
Tools are important but secondary—the user might default to Lighthouse, but I should steer them toward axe-core for deeper ARIA checks. Emphasize manual testing with NVDA/JAWS/VoiceOver because ARIA is for AT users. The deliverable should be actionable, so defect examples with code fixes will help their dev team.
Wait, did I cover all WAI-ARIA roles? Implicit vs explicit roles matter for focusability. Maybe add a note about not overriding native semantics unless necessary. Also, touch target size is keyboard-related for mobile users. Should I include swipe gestures? The query says "keyboard flows" so maybe stick to keyboard, but mobile flip-flop between touch and keyboard is common now. Better keep focused (pun intended).
Finally, the user might need to convince stakeholders, so I'll frame recommendations as business risks (legal, UX) but keep the tone technical. No fluff—just what to test, how, and why. Avoid over-explaining ARIA specs; assume they know basics. If they don't, they'll ask follow-ups. Excellent. A focus management audit is crucial for ensuring your application is operable and perceivable for keyboard and screen reader users. Here is a comprehensive, phased audit plan aligned with WAI-ARIA best practices and WCAG 2.1/2.2 Success Criteria.
Focus Management Audit Plan
Objective: To systematically evaluate and verify that interactive elements, dynamic content updates, and modal/dialog interactions are managed correctly for keyboard and assistive technology (AT) users, following WAI-ARIA 1.2 Authoring Practices.
Phase 1: Discovery & Preparation
-
Audit Scope Definition:
- Identify all user flows: core tasks (login, checkout, form completion), complex widgets (menus, grids, tabs, carousels, modals), and dynamic content areas (notifications, live feeds).
- Prioritize paths based on user impact and complexity.
-
Tooling Setup:
- Browser DevTools: Chrome/Edge (with
Accessibilitypane), Firefox Accessibility Inspector. - Automated Scanners:
axe-core(browser extension or CLI), WAVE Evaluation Tool. (Note: Use these for baseline, but they catch ~30% of focus/ARIA issues). - Screen Readers (MANDATORY):
- Windows: NVDA (free), JAWS (de facto standard).
- macOS/iOS: VoiceOver (built-in).
- Keyboard Only: Disable mouse/trackpad. Use
Tab,Shift+Tab,Arrow Keys,Enter/Space,Escape.
- Browser DevTools: Chrome/Edge (with
-
Knowledge Base:
- Review WAI-ARIA Authoring Practices 1.2: https://www.w3.org/WAI/ARIA/apg/
- Review WCAG 2.1/2.2 SCs: 2.1.1 Keyboard, 2.1.2 No Keyboard Trap, 2.4.3 Focus Order, 2.4.7 Focus Visible, 4.1.3 Status Messages.
Phase 2: Manual Testing & Evaluation
Test each identified flow using the Keyboard-Only + Screen Reader method simultaneously.
A. Global Keyboard Navigation & Focus Flow (WCAG 2.1.1, 2.4.3)
- Logical Tab Order:
- Tab through the entire page. Does focus move in a logical, predictable sequence (typically top-left to bottom-right, following visual layout)?
- Red Flag: Focus jumps unexpectedly (e.g., from header to footer, skipping main content). Fix: Ensure DOM order matches visual order or use
tabindexsparingly (only0or-1).
- Focus Visibility (WCAG 2.4.7):
- Is the focused element clearly visible? Check for a strong, high-contrast outline (not removed by
outline: nonewithout replacement). - Test: Does the focus indicator remain visible across all interactive states (hover, active, disabled)?
- Is the focused element clearly visible? Check for a strong, high-contrast outline (not removed by
- All Interactive Elements Reachable:
- Can you reach every link, button, form control, and custom widget via
Tab? - Red Flag: Custom elements (
<div>,<span>) acting as buttons/links withouttabindex="0"and proper ARIA role (role="button",role="link").
- Can you reach every link, button, form control, and custom widget via
- Avoiding
tabindex> 0:- Search for any
tabindex="1",2, etc. This creates a non-sequential, brittle tab order. Best Practice: Use natural DOM order.
- Search for any
B. ARIA Live Regions (WCAG 4.1.3 Status Messages)
- Appropriate Use:
- Are live regions (
aria-live="polite"or"assertive") used only for non-interactive, programmatically inserted status updates (e.g., form validation errors, search results count, "item added to cart" toast)? - Red Flag: Using
aria-liveon large, frequently changing containers (e.g., a chat log withoutaria-atomic). This causes verbose, repetitive announcements.
- Are live regions (
- Politeness Level:
polite: waits for current speech to finish (e.g., success messages, content updates).assertive: interrupts immediately (e.g., critical error, timeout warning). Use extremely sparingly.
aria-atomic&aria-relevant:- When a node inside a live region updates, should the entire region be announced (
aria-atomic="true"), or just the changed part (false)? Usetruefor concise updates. aria-relevantcontrols what types of changes trigger announcements (default:additions text). Is it correctly set?
- When a node inside a live region updates, should the entire region be announced (
- Testing with Screen Reader:
- Trigger the update. Does the screen reader announce it automatically and correctly without requiring focus movement?
- Test: Is the announcement concise? Does it make sense out of context?
C. Focus Traps & Modals/Dialogs (WCAG 2.1.2 No Keyboard Trap)
- Dialog Implementation (WAI-ARIA Pattern):
- Does the modal use
role="dialog"orrole="alertdialog"? - Is
aria-modal="true"present? This tells AT to confine focus to the dialog and trap it (safely). - Is there an accessible name (
aria-labelledbyoraria-label)?
- Does the modal use
- Focus Trap Mechanics:
- On Open: Does focus move immediately into the dialog (usually to the first focusable element or the dialog container with
tabindex="-1"for initial focus)? - While Open: Can
Tab/Shift+Tabcycle only within the dialog's focusable elements? Focus must not escape to the background page. - On Close (CRITICAL): Does focus return to the element that triggered the dialog (the "invoker")? This restores the user's context.
- On Open: Does focus move immediately into the dialog (usually to the first focusable element or the dialog container with
- Escape Key:
- Does
Escapeclose the dialog and return focus to the invoker?
- Does
- Background Content: Is background content inert (e.g.,
inertattribute oraria-hidden="true"on the main content)? This prevents AT from navigating into it. - Testing: Open a dialog. Try to tab to the background. Press Escape. Confirm focus returns correctly.
D. Advanced Widgets (Tabs, Menus, Grids - APG Patterns)
- Follow Established Patterns: Do custom widgets implement the exact keyboard interaction model defined in the WAI-ARIA APG?
- Tabs:
Arrow Left/Rightto move between tabs,Home/Endto jump to first/last.Tabmoves into/out of tabpanel. - Menu Bar:
Arrow Left/Right/Up/Downto navigate.Enter/Spaceto activate.Escapeto close and return to invoker. - Combobox:
Alt+Down Arrowto open list,Arrow Up/Downto navigate options,Enterto select,Escapeto close.
- Tabs:
- ARIA Attributes Correctness:
- Check roles (
role="tablist",role="tab",role="tabpanel", etc.). - Check states (
aria-selected,aria-expanded,aria-controls,aria-activedescendantfor grids). - Red Flag: Mismatched
aria-controls/idreferences, missingaria-selectedon active tab.
- Check roles (
Phase 3: Validation & Reporting
- Defect Logging:
- For each issue, document:
- Component/Page
- WCAG SC & WAI-ARIA Best Practice Violated
- Steps to Reproduce (exact keystrokes, screen reader commands).
- Expected vs. Actual Behavior.
- Severity: Critical (keyboard trap, no focus return), Major (missing announcements, incorrect widget interaction), Minor (focus order quirk, weak indicator).
- Suggested Fix (e.g., "Add
aria-modal="true"and manage focus programmatically on open/close").
- For each issue, document:
- Positive Findings: Also note components that excel at focus management (good for knowledge sharing).
- Report Structure:
- Executive Summary: Overall health, critical blocker issues.
- Methodology: Tools, screen readers, browsers used.
- Detailed Findings: Grouped by category (Global Keyboard, Live Regions, Dialogs, Widgets). Use screenshots/video clips (Loom) to demonstrate issues.
- Prioritized Action Plan: Roadmap for fixes (P0: Fix traps immediately; P1: Implement APG patterns; P2: Polish focus order/indicators).
- Appendix: Raw automated scan results (for reference only).
Critical WAI-ARIA "Do Nots" (Common Pitfalls)
- DO NOT use
role="application"unless absolutely necessary (it switches AT to a "browse mode off" mode and breaks standard navigation). - DO NOT create custom widgets from
<div>/<span>without implementing the full keyboard interaction model from the APG. - DO NOT move focus programmatically without restoring it (unless opening a modal, then restore to invoker).
- DO NOT rely solely on
:focusCSS for visibility—test with high-contrast OS settings. - DO NOT use
aria-livefor content that users need to interact with (like a chat input box).
Final Recommendation:
This audit must be manual and human-centric. Automated tools are a starting point, but the nuances of focus trapping, live region announcements, and complex widget interactions require a skilled tester using both keyboard and screen reader. The goal is not just to pass a checklist, but to ensure a fluid, intuitive, and non-frustrating experience for users who cannot use a mouse.
Deliverable: A clear, actionable report with specific code-level recommendations for your development team to implement the fixes following the WAI-ARIA APG patterns.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.