Skip to content

Move useLongPress to Pointer Events #580

Open

Description

@hyesungoh

useLongPress listens to both touch and mouse events. After a tap, browsers fire emulated mousedown/mouseup, so one tap is handled as two presses. #576 works around this by ignoring mouse presses within 1 second of a touch, which is a heuristic.

Listening to pointerdown/pointerup/pointercancel instead gives one event stream per press, so the emulated mouse events never reach the hook. pointercancel also cancels the press when the browser starts scrolling, which the hook does not handle today.

This is a breaking change:

  • The returned handlers become onPointerDown, onPointerUp, onPointerLeave, onPointerCancel (and onPointerMove with moveThreshold).
  • Callbacks receive PointerEvent instead of MouseEvent | TouchEvent.

Notes:

References: react-aria, ahooks, use-long-press

Waits for #576.

Activity

  1. hyesungoh commented on Oct 28, 2026

    @hyesungoh
    MemberAuthor

    @rjsgud49 please check this issue 🙏

  2. rjsgud49 commented on Oct 28, 2026

    @rjsgud49
    Contributor

    Thanks for merging #576! I'll pick this up and open a PR soon 🙂

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions