feat(cdp): implement Input.setInterceptDrags and Input.dragIntercepted by Supersynergy · Pull Request #1822 · lexmount/moli · GitHub
Skip to content

feat(cdp): implement Input.setInterceptDrags and Input.dragIntercepted - #1822

Open
Supersynergy wants to merge 5 commits into
lexmount:mainfrom
Supersynergy:pr/drag-interception
Open

Supersynergy wants to merge 5 commits into
lexmount:mainfrom
Supersynergy:pr/drag-interception

Conversation

@Supersynergy

@Supersynergy Supersynergy commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1101.

Implements session-scoped Input.setInterceptDrags and publishes Input.dragIntercepted with the native DataTransfer items and operation mask. The renderer retains the source element and dispatches dragend when the drag ends.

v1.1.19 already has coordinate-based Input.dispatchDragEvent under real layout. This patch connects native interception to that replay path, including the initial dragenter/dragover pair; mock geometry retains the unsupported response. Cancellation clears the intercepted protocol state.

Release base: v1.1.19 (bd0ddc3f8d8886f1bf339694ebdc89bfb4848efa). The existing topic commits are retained.

Local validation on macOS arm64 refers to the combined integration tree: formatting, full workspace Clippy with all targets/features and -D warnings, and 20,531 Nextest tests passed with 18 skipped. Test optimization was 0; the macOS helper retains full fetch-owner debug symbols for its backtrace assertion. The combined tree also includes the other topic PRs, signal shutdown, security dependency updates and test portability adjustments.

The signed release candidate from that combined tree also passed 6/6 live-geometry checks and 17/17 browser checks, including native drag replay with dragend and profile restart with an open CDP connection.

CI compatibility: backported the current upstream supervisor options --strict-full-suite and Chromium --retries. The v1.1.19 runner otherwise exits before launching a browser under the current CI workflow. All 79 Python runner tests completed (2 skipped), including strict coverage and retry isolation.

Playwright drives HTML5 drag and drop on Chromium through
Input.setInterceptDrags: the browser keeps the drag from running in the
page and hands the client the DataTransfer content, which the client
replays with Input.dispatchDragEvent. moli had the replay half but its
own mouse-driven drag session never ended with dragend and could not be
handed over.

The renderer now reports an uncanceled dragstart as an intercepted drag
(string items from setData plus the dragOperationsMask derived from
effectAllowed) when the mouse command asks for interception. In that
mode mouse events stop driving dragover and drop. The session remembers
its source element and dispatches dragend there after drop, dragCancel
or a plain mouse release. For an intercepted drag, dragenter is followed
by a dragover on the same target, as in Chromium.

The protocol crate still passes false for the new flag, so behaviour on
the wire does not change in this commit.
Input.setInterceptDrags used to fail, which made every Playwright mouse
move with a pressed button throw and left locator.dragTo timing out.

The command now stores the flag per target and succeeds. While it is
on, mouse events carry it to the renderer. When the renderer reports a
drag start, the connection sends Input.dragIntercepted with the string
items and dragOperationsMask, so the client can replay the drag through
the existing Input.dispatchDragEvent. A drop or dragCancel clears the
intercepted-drag state again.

Files and directories in the drag data are not forwarded.
@ldm0
ldm0 self-requested a review October 21, 2026 11:10

Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Contributor Author

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