Skip to content

ui-kit: a rank handle drag right after a native pointercancel does not reorder #3895

Open

Description

@schlessera

Context

Found during the test-health push (#3855), batch e3855-ui-kit-05. Needs scoping. There are no acceptance criteria yet.

a handle drag crosses rows and a native pointercancel restores the exact previous order (packages/ui-kit/tests/visual/rank-touch.visual.tsx:39-60) starts a drag, cancels it natively, then drags again. Between those steps it sleeps for fixed times: 200 ms after the first move (line 45), 100 ms after the cancel (line 48) and 200 ms before the second release (line 56).

I replaced the first two sleeps with polls on the visible order. The live reorder and the restored order both appeared at once, so each poll passed immediately. The second drag then started straight after the cancel, and its release did not reorder the rows. The final order assertion (line 58) failed in 10 of 10 runs on the pinned browser image. With the sleeps restored, the case passes.

So after a native pointercancel, AskUserRankCard (packages/ui-kit/src/decisions/AskUserRankCard.tsx) needs time before a new handle drag takes effect. The order looks restored before that point. Nothing in the test or the component explains why.

Candidate causes, from reading the source at main 91e54be37 (not yet observed):

  • cancel (packages/ui-kit/src/decisions/AskUserRankCard.tsx:108-116) restores the order with apply. The useLayoutEffect at :162-172 then animates every row whose offsetTop moved with a 150 ms translateY FLIP (:166-167), unless reduced motion is on. DOM order, which order() reads, is restored at once, but point(2) reads the handle's getBoundingClientRect, which includes the running transform. A drag started inside those 150 ms starts from a moving row. This fits "the order looks restored before that point".
  • Pointer capture: cleanupDrag (:98-107) releases capture, and onLostPointerCapture (:240) calls cancel again when a drag is active. A new touchStart that arrives before the browser has delivered lostpointercapture for the cancelled pointer could have its new drag cancelled.
  • A requestAnimationFrame tick (startDrag, :173-199) is cancelled in cleanupDrag, so a stale frame is unlikely, but it is not ruled out.

Nothing in the component or its decision records describes a pause after a cancel before a new drag may start. If the cause drops a drag a real user could make on the visible handle, that is a product defect.

Scope

  • Find which state outlives the cancel. Record the observation (for example, getAnimations() on the rows, or the event order around lostpointercapture) in the PR.
  • If the cause is test-side, such as reading coordinates from a row that is still animating: replace the sleeps at lines 45 and 48 with waits on that observed state, and keep every assertion.
  • If the component drops a drag a real user could start on the visible handle: file a separate type: fix issue with the observation. Keep the line-48 sleep with a comment that points at that issue.

Out of scope

  • Raising any timeout, or adding a retry.
  • The edge auto-scroll case in the same file.

Acceptance criteria

  • The PR names the state that outlives the cancel, with the observation that shows it.
  • Either the case no longer sleeps at lines 45 and 48 and passes 10 of 10 runs on the pinned browser image, with a mutation (for example, removing the new wait) that fails the final order assertion at line 58; or a type: fix issue is filed with the observation and linked from a comment at line 48.
  • No timeout is raised and no retry is added.

Verification

node scripts/visual.mjs --project=visual --filter=rank-touch.visual, with the line-48 sleep replaced by await expect.poll(order).toEqual(ids()).

Contract impact

None.

Activity

  1. added
    type: test
    area: ui-kit
    on Nov 10, 2026
  2. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Triage, 2026-11-10, at main 91e54be37: added acceptance criteria and candidate causes from reading the source. The leading candidate is the 150 ms FLIP animation that cancel triggers through apply (AskUserRankCard.tsx:162-172): DOM order comes back at once while the rows are still moving. None of the causes has been observed yet. The investigation's two outcomes are in Scope. A component defect gets its own type: fix issue; a test-side cause is fixed here by waiting on the observed state. Attached to #2753, which covers waiting on observed state instead of fixed delays. Priority p2, ready.

  3. added
    priority: p2
    agent-ready
    on Nov 10, 2026
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

    agent-readyarea: ui-kitpriority: p2type: test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions