Skip to main content
InterviewHubPRO
Section Overview
Q26

Question 26 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

52%
Web Accessibility & WCAG (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Custom Focus Management in Single Page Applications (SPAs).

senior LevelCode ExampleSystem Design

In Simple Words: In traditional websites, full page navigation reloads the document, placing screen reader focus at the top (<title>). In SPAs (React, Next.js, Vue), client-side route transitions swap the DOM silently. Screen reader focus is stranded!

  • SPA Routing Focus Fix:
    1. On route change, update document <title>.
    2. Move focus programmatically to the main heading (<h1>) or <main> container:
      javascript
      document.getElementById('main-heading')?.focus();
      
    3. Emit an announcement via an aria-live region: "Navigated to Dashboard page".