Skip to content

Add DRAG - #25

Merged
brynary merged 1 commit into
pointer-buttonsfrom
drag
Oct 5, 2026
Merged

brynary merged 1 commit into
pointer-buttonsfrom
drag

Conversation

@brynary

@brynary brynary commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Stacked on #24. The second of three pointer-action PRs: drag and drop, as a flow command and as an ACT method.

Change

Part Change
Syntax DRAG source to target. A bare to separates the locators; a quoted "to" is text, and whirl fmt keeps its quotes. Both locators use the text: default engine and must match one element.
Gesture The shim hovers the source, presses, holds 500 ms, waits for the target to be visible and stable, moves in 10 steps, waits two animation frames, and releases. It releases the button even when a step fails. Playwright's dragTo cannot hold, so the shim uses page.mouse.
ACT dragAndDrop with one argument: the ref of the element to drop on. An unknown ref, or the dragged element itself, fails with act-invalid-decision. The prompt explains the argument. With --jev, drags go to the model.

What the tests found

Case Chromium Firefox WebKit
Native HTML5 board ✓ ✓ ✓
Pointer events, starts after an 8 px move ✓ ✓ ✓
Pointer events, starts after a 300 ms press ✓ ✓ ✓
Native drag inside an iframe ✓ ✓ ✓
Native drag from the page into an iframe ✓ ✓ ✓
  • Without the hold, the 300 ms board fails in every engine, including with Playwright's own dragTo.
  • A trial hover on the target, which would also check that nothing covers it, stops a native drag in Chromium. The shim scrolls the target into view instead.
  • In WebKit, a page that took a native drag gets mousedown but no pointerdown on later presses until it loads again. Playwright's dragTo behaves the same. SPEC §7 says so, and the board test runs its pointer drags first.

Not in the plan

The plan listed a targetDescription report field. The action's line already names both elements (DRAG role:article "Card" to role:region "Done"), so the report keeps its shape.

Tests

  • Browser: the three boards and both frame cases in all three engines; an ambiguous drop target fails with its candidates.
  • ACT: a model drag, an unknown drop target, and a --jev drag that goes to the model.
  • Unit: parsing and its errors, fmt quoting of to, the decision, and the prompt.
  • Eval: a kanban-move task on a native board.
  • mise run check passes. SPEC §3.1, §6.1, §6.2, §7, §7.4, §17, and §18, the shim protocol doc, and the CHANGELOG describe the change.

🤖 Generated with Claude Code

DRAG source to target drags one element onto another. A bare `to`
separates the two locators, which both use the text default engine and
the strictness rules; a quoted "to" is text, and `whirl fmt` keeps its
quotes.

The shim runs the gesture itself, because Playwright's dragTo cannot
hold: it hovers the source, presses, holds 500 ms, waits for the target
to be visible and stable, moves in 10 steps, waits two animation
frames, and releases, releasing even when a step fails. The hold serves
drag code that starts after a press delay, and the steps serve code that
starts after a short move. The target check scrolls it into view instead
of a trial hover, which stops a native drag in Chromium.

ACT runs dragAndDrop, whose one argument is the ref of the element to
drop on; an unknown ref or the dragged element itself fails with
act-invalid-decision. With --jev, drags go to the model.

Tests cover a native board, a board that starts after an 8px move, one
that starts after a 300ms press, drags into and across frames in all
three engines, an ambiguous target, and the ACT paths. In WebKit a page
that took a native drag gets no pointerdown until it loads again; the
SPEC says so, and the board test runs its pointer drags first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brynary brynary mentioned this pull request Sep 27, 2026
@brynary
brynary added this pull request to stack #55 October 5, 2026 13:05
@brynary
brynary merged commit 6064828 into pointer-buttons Oct 5, 2026
3 checks passed
@brynary
brynary deleted the drag branch October 5, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant