Skip to content

fix: preserve CDP mouse button state - #267

Open
TheKevinWang wants to merge 2 commits into
cdpdriver:mainfrom
TheKevinWang:codex/cdp-mouse-event-parity-upstream
Open

fix: preserve CDP mouse button state#267
TheKevinWang wants to merge 2 commits into
cdpdriver:mainfrom
TheKevinWang:codex/cdp-mouse-event-parity-upstream

Conversation

@TheKevinWang

@TheKevinWang TheKevinWang commented Aug 17, 2026

Copy link
Copy Markdown

Previously, releases retained the pressed buttons mask, drag movement omitted
the held button, and no event supplied CDP's force value. Consequently, page
JavaScript could see zero PointerEvent.pressure during a held drag. The two
movement-only helpers also emitted an unrelated release.

The patch:

  • reports force=0.5 while a mouse button is active and force=0 on release;
  • keeps buttons=1 on left-button drag movement and changes to buttons=0 on
    release;
  • removes synthetic releases from Tab.mouse_move() and
    Element.mouse_move().

The 0.5 value follows the Pointer Events definition for a device that does
not support pressure: pressure is 0.5 while any button is active and 0
otherwise. Chromium's CDP exposes this directly through the optional force
field on Input.dispatchMouseEvent.

#268

@TheKevinWang
TheKevinWang requested a review from a team as a code owner August 17, 2026 21:56
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