Skip to content

fix(ui): make interactive data-table rows keyboard accessible (closes #16) - #67

Open
ghzhost wants to merge 1 commit into
forthfate:mainfrom
ghzhost:fix/datatable-keyboard-accessibility
Open

ghzhost wants to merge 1 commit into
forthfate:mainfrom
ghzhost:fix/datatable-keyboard-accessibility

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes clickable rows in the shared DataTable component accessible via keyboard navigation, resolving #16.

Changes

  1. Keyboard focusability: When onRowClick is provided, assign tabIndex={0} and role="button" to the row container.
  2. Keyboard activation: Added an onKeyDown handler listening for Enter and Space ( ) to trigger onRowClick(row), with event.preventDefault() to prevent scrolling on Space.
  3. Preserve nested controls: Checked !(event.target as HTMLElement).closest("button,input,select,textarea,a") so interactions with nested form elements/links do not inadvertently trigger the row action.
  4. Non-interactive rows: Left untouched without tabIndex or role.
  5. Focus styles: Added .tr--interactive:focus-visible styling matching the design tokens (--accent, --surface-raised).

Verification

  • pnpm --filter agent-improvement-console-ui run lint passes.
  • pnpm --filter agent-improvement-console-ui run build builds successfully without TypeScript or bundling errors.

Closes #16

- Add tabIndex=0, role="button", and Enter/Space onKeyDown handler when onRowClick is present
- Keep non-interactive rows unchanged
- Ensure clicks/keypresses on nested interactive controls are not intercepted
- Add visible focus styling for keyboard navigation

Closes forthfate#16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make clickable data-table rows keyboard accessible

1 participant