Premium

Grid Rectangle Selection

By FrontendAtlas Editorial · Updated Nov 25, 2026

Challenge summary

Make a sheet of cells selectable like a spreadsheet in React: one cell on a click, a rectangle on a drag or a Shift-click in any direction, arrow keys that move and extend the selection, and Escape to clear it.

What you'll practice

  • Model a selection as an anchor and a focus, and derive the rectangle from them in any direction.
  • Follow a mouse drag from the press through the cells it passes to the release.
  • Move focus through a grid with a roving tabindex and extend the selection with Shift.
  • Expose the selection with aria-selected and a live summary.

What Premium unlocks

Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.

Free related practice

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.

Premium is $24 a month or $99 a year, less in many countries.