Skip to content

useMove: when is onMoveStart fired? #4056

Closed
@mischnic

Description

@mischnic

🙋 Documentation Request

https://react-spectrum.adobe.com/react-aria/useMove.html#features

A move interaction starts when a user presses down with a mouse or their finger on the target, and ends when they lift their pointer.

This sounds like onMoveStart behaves like onPressStart. But in reality it's called just before the first onMove event:

if (!state.current.didMove) {
state.current.didMove = true;
onMoveStart?.({
type: 'movestart',
pointerType,
shiftKey: originalEvent.shiftKey,
metaKey: originalEvent.metaKey,
ctrlKey: originalEvent.ctrlKey,
altKey: originalEvent.altKey
});
}
onMove({
type: 'move',
pointerType,
deltaX: deltaX,
deltaY: deltaY,
shiftKey: originalEvent.shiftKey,
metaKey: originalEvent.metaKey,
ctrlKey: originalEvent.ctrlKey,
altKey: originalEvent.altKey
});

So I guess the current behaviour is correct and the docs are wrong (should instead say something like "it starts when the user first moves the pointer after pressing down")?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions