FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Modal Dialog II

40 mins

Build a semi-accessible modal dialog component in React that follows basic ARIA roles and properties.

Requirements:

  1. A button opens the modal.
  2. Modal contains a title, content, and a close button.
  3. Clicking the close button or outside the modal closes it.
  4. Accessibility:
    • Use role="dialog" for the modal.
    • Add aria-modal="true".
    • Connect modal title with aria-labelledby.
    • Connect modal description with aria-describedby.
  5. No need for advanced focus trapping or keyboard navigation (semi-accessible).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component