Skip to content

fix: Dispatch mouseup for presses released outside the target - #10129

Open
Harrison0223-svg wants to merge 1 commit into
playcanvas:mainfrom
Harrison0223-svg:fix/mouseup-outside-target-pr
Open

Harrison0223-svg wants to merge 1 commit into
playcanvas:mainfrom
Harrison0223-svg:fix/mouseup-outside-target-pr

Conversation

@Harrison0223-svg

Copy link
Copy Markdown

Description

Dragging outside the mouse target and releasing can leave drag listeners active: the window updates its button state, but the target-bounds filter suppresses its mouseup event. Track which button presses this Mouse actually delivered and forward the matching outside release with target-relative coordinates. Keep unrelated outside events filtered and preserve pointer-lock and blur behavior. This only handles releases delivered to the attached window.

Fixes #9906

Verification: With only mouse.js stashed, the same mouse suites ran with 31 passing and 2 failing. Restoring the change gave 33 passing. Full suite: 4,974 passing and 44 pending. Lint and type checks passed locally. Physical browser drag and PR CI are not verified.

Disclosure: AI-assisted implementation and testing. Human review is pending.

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

Track presses dispatched by Mouse separately from the window-wide button state so releases can finish a drag without sending unrelated outside mouse events.

Fixed playcanvas#9906
@Harrison0223-svg

Copy link
Copy Markdown
Author

Chrome 158 on Apple Silicon, automated verification by OpenAI Codex. At 9258d38, a trusted press inside the canvas and release outside produced exactly one mouseup at (−10, 90). The base lost the release. Entirely external clicks were filtered, and detaching and reattaching the target cleared the previous press. Actual pointer lock remains unverified.

This branch has not been deployed

No deployments
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.

Mouse does not fire mouseup for a button released outside its element

1 participant