Keyboard and mouse
Keyboard
| Key | What it does |
|---|---|
↑ / ↓ | Focus moves along the rows |
| typing letters | Goes to the row by the start of its name |
→ | Focus from the row to the drag handle |
Enter on the drag handle | Starts the move; ↑/↓ choose the target, Enter applies it |
Enter on the row | Opens editing; the text is fully selected |
| double click | The same with the mouse |
Enter in the field | Confirms and returns focus to the row |
Escape in the field | Restores the previous value and focus to the row |
| click elsewhere | Confirms and does not take focus |
↓ from the last row | Moves focus to the add row |
↑ in the add row | Returns focus to the last row |
Enter in the add row | Confirms and leaves the field open |
While a row is being edited, the drag handle is disabled and the row cannot be dragged: the arrow keys belong to the caret.
Enter is handled by the component only when the row itself has focus. On
the drag handle, on a checkbox in leading and on buttons in trailing it belongs to
them: before 3.10.2 the interception caught it on any descendant of the row, and
a keyboard move never started.
Mouse
| Element | What happens |
|---|---|
| drag handle (six dots) | The "grab" cursor; press and drag to move |
| name | A double click opens editing; a single click is not handled |
| row | A click or Space calls onRowAction, if it is set |
The grab cursor is on the drag handle's wrapper, not on the move button
itself. react-aria sets pointer-events: none on the button (it is a target for
the keyboard and the screen reader, not for the pointer), and a cursor on it
would never apply. For the same reason the wrapper swallows the click: through
the button turned off for the pointer it reached the row and called
onRowAction.
What the component does not support with the mouse
The whole row is dragged, not the drag handle, and the name cannot be selected with
the mouse. Both have one cause: the move is driven by react-aria through the
native draggable on the row itself (ADR-0028), and the browser applies the
user-select: none rule to [draggable=true]. So dragging across the name does
not select it but moves the row; user-select: text on the name does not help
while draggable is on an ancestor.
There is no way around this without giving up react-aria for the move: the cost is a custom drag implementation in the kit. Nobody has asked for that implementation, and the list has behaved this way since 3.10.0, the first release.
Three things visible only in a browser
All three were found while building the component, and all fail silently: in jsdom the react-aria collection behaves differently, and a test would pass on a broken component.
dependencies={[editingId, leaving]}onGridListis required. The collection caches rows and does not re-render them when external state changes — without it editing did not open at all, while the key handler worked fine.- Focus is set in a callback ref, not in an effect. The row content mounts in
a separate pass, later than the commit: by the time of
useLayoutEffectthe field's ref is still empty. - Drafts live in the fields themselves. A draft in state would mean a render on every keystroke, and so a remount of the row and a return of the original value: what was typed got erased right during typing.
The copy icon in WebKit: a known issue with no fix available
In Safari and other WebKit builds, at the very start of a drag a system icon meaning "a copy will be made" — a green circle with a plus — appears for a fraction of a second. The list cannot copy rows, and nothing is copied: the icon lies.
Neither the kit nor the consumer can fix this, and here is why. The
component declares the only allowed operation — getAllowedDropOperations: () => ["move"]. Measurements of both engines show that the declaration is applied:
effectAllowed is written and read back as move, and react-aria additionally
writes dropEffect: move on every dragover — 24 writes per drag, and both effectAllowed and dropEffect are
accepted. Chromium honors it: the target sees move, the drag ends with move,
there is no icon.
WebKit loses the declaration at the drag-session level and hands the target
all — bug 178058, known
since 2017. all includes copying, and the operating system shows the "plus"
until the first drop target overrides it. Hence the flicker: it is the gap between
WebKit's default and the first correction.
The reordering is still correct. react-aria keeps the real set of operations in its own variable and intersects it with what the browser returned — this is its standard workaround for the same bug. Measured in WebKit: five rows before the drop, five after, and the order changed exactly as in Chromium. The row is not duplicated.
What does not help, so you do not check again:
- a custom drag preview (
renderDragPreview). The wrong value is visible in the data contract — in the target'seffectAllowed— not in the picture. The preview does not affect the operation mask. - not setting
text/plain. The icon appears on the very firstdragenterover the list itself, before any text field on the page, and in Chromium it is absent with the sametext/plain. - removing
getAllowedDropOperationsmakes things worse: copying would then really be allowed, and the icon would be telling the truth.