Repository navigation
Description
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 withapply. TheuseLayoutEffectat :162-172 then animates every row whoseoffsetTopmoved with a 150 mstranslateYFLIP (:166-167), unless reduced motion is on. DOM order, whichorder()reads, is restored at once, butpoint(2)reads the handle'sgetBoundingClientRect, 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, andonLostPointerCapture(:240) callscancelagain when a drag is active. A newtouchStartthat arrives before the browser has deliveredlostpointercapturefor the cancelled pointer could have its new drag cancelled. - A
requestAnimationFrametick (startDrag, :173-199) is cancelled incleanupDrag, 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 aroundlostpointercapture) 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: fixissue 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: fixissue 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
schlessera commentedon Nov 10, 2026
Triage, 2026-11-10, at
main91e54be37: added acceptance criteria and candidate causes from reading the source. The leading candidate is the 150 ms FLIP animation thatcanceltriggers throughapply(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 owntype: fixissue; 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.