FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Tabs II

45 mins

Build a fully accessible tabs component in React.

Requirements:

  1. Render a tablist with multiple tabs and associated tab panels.
  2. Only one tab panel is visible at a time.
  3. Tabs should be focusable and have the correct ARIA attributes:
    • role="tablist", role="tab", role="tabpanel".
    • aria-selected for the active tab.
    • aria-controls and id to link tabs and panels.
  4. Keyboard support:
    • Left/Right Arrow keys move focus between tabs.
    • Enter/Space activates the focused tab.
  5. The tab order should remain in the DOM (no conditional rendering for panels).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component