Skip to content

Conversation

@neftaly
Copy link
Contributor

@neftaly neftaly commented Dec 26, 2025

Fixes an issue where dragging an object outside the browser window and returning would break drag behavior.

Changes

  • Skip exit event when pointer leaves with capture held and button pressed
  • Re-establish DOM pointer capture on move if logical capture still exists
  • Wrap releasePointerCapture in try-catch for already-released pointers

Test

Added test cases for window leave/re-enter scenarios.

Notes

Hi Bela!

Fixes an issue where dragging an object outside the browser window and returning would break drag behavior.

## Changes

- Skip exit event when pointer leaves with capture held and button pressed
- Re-establish DOM pointer capture on move if logical capture still exists
- Wrap releasePointerCapture in try-catch for already-released pointers

## Test

Added test cases for window leave/re-enter scenarios.
@neftaly neftaly marked this pull request as draft December 26, 2025 09:35
@neftaly
Copy link
Contributor Author

neftaly commented Dec 26, 2025

I get the error "TypeError: ev.target.closest is not a function" if I left-drag something offscreen, hold down right button, then release left. However this seems to be an issue with Ublock Origin on FF and not xr.

@neftaly neftaly marked this pull request as ready for review December 26, 2025 12:04
@bbohlender
Copy link
Collaborator

@neftaly Hey, thanks for the PR

I unfortunately do not understand the underlying issue since we are captuing the pointer, there should not be an exit event from the browser and releasePointerCapture should only work if we have not released yet.

Do the tests reproduce the issue?

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.

2 participants