Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
72

Frontend System Design · Lesson 72 of 86 · 3 min

Accessibility in Component Libraries

This isn't about ticking boxes; it's about demonstrating you build robust, professional-grade systems. Answering this well separates senior from mid-level engineers.

Start with Semantic HTML

Your most powerful accessibility tool is using the right HTML element for the job. Native elements like <button>, <input>, <nav>, and <h2> have accessibility built-in for free. A <button> is already focusable, keyboard-operable, and announced as a "button" by screen readers.

A div is none of those things.

The trap: Rebuilding native functionality with divs and spans. If you find yourself adding role="button", tabindex="0", and a keyDown handler to a div, you've almost certainly made a mistake. The first rule of ARIA is: don't use ARIA if a native HTML element already does what you need.

Start with semantics. Only move on to custom solutions when there is no native element for the UI pattern you're building.

Use ARIA for Custom Components

Modern UIs have complex components like tabs, custom selects, and toggle switches that don't have a one-to-one HTML equivalent. This is where you use ARIA (Accessible Rich Internet Applications) to bridge the gap. ARIA provides extra semantics for assistive technologies.

ARIA attributes fall into three types:

  • Roles: Define the component's type, like role="switch" or role="tablist".
  • States: Describe the component's current condition, like aria-checked="true" or aria-expanded="false".
  • Properties: Provide additional information, like aria-label="Close" to give a button an accessible name.

Here’s a custom toggle switch. It's a common pattern that requires ARIA to be understood by screen readers. Notice how role, aria-checked, tabIndex, and keyboard handlers work together.

import React, { useState, useId } from 'react';

type ToggleSwitchProps = {
  label: string;
};

const ToggleSwitch: React.FC<ToggleSwitchProps> = ({ label }) => {
  const [isChecked, setIsChecked] = useState(false);
  const id = useId();

  const handleToggle = () => {
    setIsChecked(prevState => !prevState);
  };

  const handleKeyDown = (e: React.KeyboardEvent) => {
    if (e.key === ' ' || e.key === 'Enter') {
      e.preventDefault();
      handleToggle();
    }
  };

  return (
    <>
      <span id={id}>{label}</span>
      <div
        role="switch"
        aria-checked={isChecked}
        aria-labelledby={id}
        tabIndex={0}
        onClick={handleToggle}
        onKeyDown={handleKeyDown}
        style={{ display: 'inline-block', cursor: 'pointer', userSelect: 'none' }}
      >
        {/* Visual representation of the switch would go here */}
      </div>
    </>
  );
};

This is the correct use of ARIA: enhancing a non-native element to behave like a standard UI control that doesn't exist in HTML.

Master Keyboard Navigation and Focus

Many users navigate exclusively with a keyboard. If your component isn't keyboard-operable, it's inaccessible. There are three critical aspects to get right.

First, logical tab order and visible focus. Interactive elements must be reachable in a predictable sequence using the Tab key. The currently focused element must have a highly visible style (e.g., an outline). Never use CSS outline: none; without providing a different, equally clear focus indicator.

Second, focus traps. For any component that overlays the page, like a modal dialog, you must "trap" the user's focus inside it. Tabbing should cycle through the modal's interactive elements and not escape to the page underneath. Pressing Escape should close the modal.

Third, focus restoration. When the user closes the modal, focus must return to the element that opened it. Losing the user's place on the page is a jarring experience.

In an interview, expect deep probes on focus management. Describing how you'd implement a focus trap for a modal (finding all focusable elements, handling Tab and Shift+Tab at the boundaries, and restoring focus on close) is a classic test of frontend depth.

Systematize Accessibility, Don't Bolt It On

In a system design interview, your goal is to show you can make the entire system accessible by default, not just one component. You do this by building accessibility into the library's foundation and processes.

In the design system: Define accessible color palettes with sufficient contrast ratios as design tokens. Make sure typography scales are legible.

In the development process: Integrate automated accessibility checks into your CI/CD pipeline using tools like axe-core. This catches low-hanging fruit like missing alt text or insufficient color contrast on every pull request.

In the documentation: For every component, document its expected keyboard interactions and any required ARIA attributes. This teaches consumers of your library how to use the components accessibly.

This lifecycle approach makes accessibility a shared responsibility and a core quality metric, not an afterthought.

Try it

Find a "custom checkbox" component on CodePen or a similar site that is styled with divs and spans. Spend 15 minutes refactoring it. Make it focusable, checkable with the Space key, and ensure it uses the correct role and aria-checked attributes so its state is announced by a screen reader.

Next: Component Library Docs, Testing and Versioning

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Theming and Customization in Design Systems

Next

Component Library Docs, Testing and Versioning