Skip to content

Add keyboard navigation support for data table rows #268

Description

@usmanimamu17-create

The DataTable component (src/components/data-table.tsx) supports row selection via click, but does not implement keyboard navigation. Users cannot navigate between rows using arrow keys, select rows with Enter/Space, or open row details with Enter. This violates WCAG 2.1 keyboard accessibility requirements.

Why this is architecturally hard

  1. Table uses TanStack Table's useReactTable hook without built-in keyboard navigation primitives
  2. Virtualized rows are absolutely positioned, making traditional DOM focus management incompatible
  3. Table body must maintain a "roving tabindex" pattern where only one row is focusable at a time

Proposed design

Implement a useTableKeyboardNavigation hook that maintains focusedIndex state, listens for ArrowUp/ArrowDown/Enter/Space key events, updates focus index within bounds, sets tabIndex on focused row, and triggers selection on Enter/Space.

Acceptance criteria

  • Pressing ArrowDown/ArrowUp moves focus between adjacent rows
  • Pressing Enter or Space selects the focused row
  • Focused row has visible focus ring indicator
  • Screen reader announces row content when focused

Getting started

Files: src/components/data-table.tsx

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaignaccessibilityissue-trackingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions