Skip to content

fix: allow first table drag interaction #10423 - #10602

Open
anu-priya-1999 wants to merge 2 commits into
adobe:mainfrom
anu-priya-1999:fix/table-first-drag-interaction
Open

anu-priya-1999 wants to merge 2 commits into
adobe:mainfrom
anu-priya-1999:fix/table-first-drag-interaction

Conversation

@anu-priya-1999

@anu-priya-1999 anu-priya-1999 commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Fixes #10423

Fixes an issue where the first drag interaction on a draggable React Aria Table row could fail when initiated from the row's drag handle.

Root cause

useGridCell temporarily removes the cell's tabIndex on pointer down when selection occurs on press up. This prevents the browser from focusing the cell while starting a drag.

The logic previously only installed this handler when gridCellProps.onPointerDown was not already defined. With the current useSelectableItem behavior, the cell can already have an onPointerDown handler, causing the useGridCell handler to be skipped entirely.

As a result, the cell keeps its tabIndex during the first drag interaction and the drag handle can fail to start the drag correctly.

Fix

  • Always install the useGridCell pointer-down handling when shouldSelectOnPressUp and tabIndex are applicable.
  • Preserve and invoke any existing onPointerDown handler instead of replacing it.
  • Continue temporarily removing and restoring the cell's tabIndex during pointer interaction.

Testing

Added a regression test verifying that the cell's tabIndex is removed on the first drag interaction and restored afterward.

Validated with:

  • packages/react-aria-components/test/Table.test.js
  • 177 passed, 1 skipped

@snowystinger

Copy link
Copy Markdown
Member

Looks like this is failing a test

@anu-priya-1999

Copy link
Copy Markdown
Author

Thanks for the feedback. I tracked the failing test down to the drag tabIndex workaround also running during keyboardNavigationBehavior="tab".

I updated the fix so the temporary tabIndex removal only applies to non-tab keyboard navigation, while preserving the existing onPointerDown handler.

Validated locally:

  • @react-spectrum/s2 TableView tab-navigation regression: passing
  • react-aria-components first-drag regression: passing
  • Combined: 184 passed, 1 skipped
  • git diff --check: passing

The full CircleCI suite is now passing as well. The remaining merge blockers are the required reviews and maintainer approval for the workflow.

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.

Can't reorder rows on first drag in button handle on React Aria Table

2 participants