From 1f4b6b9d7aff0b2d4aceac954fddc7a00f93cc4c Mon Sep 17 00:00:00 2001 From: juniper929 <165760126+juniper929@users.noreply.github.com> Date: Tue, 31 Mar 2026 09:21:04 +0800 Subject: [PATCH] fix: include buttons bitmask in drag mouseMoved events (#1087) * fix: include buttons bitmask in drag mouseMoved events The drag handler was omitting the `buttons` field from every `mouseMoved` event dispatched during the move phase. Without it the browser sees `event.buttons === 0`, meaning no button is held, so `dragstart`/`dragover`/`drop` never fire and the drop target never receives the element. Fix: - Add `"buttons": 1` (left-button mask) to each `mouseMoved` sent while the button is held. - Add `"buttons": 1` to `mousePressed` and `"buttons": 0` to `mouseReleased`, consistent with how `dispatch_click` handles the same fields in interaction.rs. - Correct the parity-test fixture for `drag`, which was supplying a `selector` key instead of the `source` key that `handle_drag` reads. - Add an e2e test (`e2e_drag_action_sends_buttons_during_move`) that drives the high-level `drag` action against the existing `html5_drag_probe` fixture and asserts that `mousemove` events carry `buttons == 1` and that `dragstart` fires on the source element. Co-Authored-By: Claude Sonnet 4.6 * style: fix rustfmt formatting in e2e drag test --------- Co-authored-by: wangjingjing Co-authored-by: Claude Sonnet 4.6 Co-authored-by: ctate <366502+ctate@users.noreply.github.com> --- cli/src/native/actions.rs | 9 +++-- cli/src/native/e2e_tests.rs | 67 ++++++++++++++++++++++++++++++++++ cli/src/native/parity_tests.rs | 2 +- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/cli/src/native/actions.rs b/cli/src/native/actions.rs index 4cb6757..7f3f743 100644 --- a/cli/src/native/actions.rs +++ b/cli/src/native/actions.rs @@ -5448,12 +5448,13 @@ async fn handle_drag(cmd: &Value, state: &mut DaemonState) -> Result Result Result Value { obj.insert("script".to_string(), json!("h => h")); } "drag" => { - obj.insert("selector".to_string(), json!("body")); + obj.insert("source".to_string(), json!("body")); obj.insert("target".to_string(), json!("body")); } "swipe" => {