Repository navigation
Keep the pointer lock across app switches; build 6 - #25
Merged
Merged
Conversation
TestFlight feedback: clicking sometimes moved the cursor across the screen, the plain iPadOS pointer came back after leaving and returning to the app, and the lock often dropped leaving the game unusable. Every scene deactivation (app switch, Control Center, Notification Center, a system alert or banner, a screenshot) force-unlocked the page, and any system lock drop did the same. The game then sat on its "click to resume" screen with the iPadOS pointer showing, and that click moved the game's cursor to wherever the pointer was. - Leaving the foreground now only pauses input. The polyfill's new suspend() lets go of held buttons (no click) and keys but keeps the lock; prefersPointerLocked stays true, so iPadOS re-locks the pointer when the app is active again. - On return, resume() takes the lock back for the same element if the page dropped it while away (pages may exit on blur). A release the user asked for (Esc, Cmd-., three-finger tap) or a lock that ended with the button (Figma's scrub) isn't taken back. - A system lock drop while active and full screen keeps the page's lock and asks UIKit for the pointer again; leaving full screen (Slide Over, Split View, Stage Manager) still releases it. - Diagnostics log lock-lost and lock-resume, so Copy diagnostics shows what happened in the next report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MACMbGBEjiVd3vDapSRQm
…-t8u1gh # Conflicts: # README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Martin · project thread
Why
TestFlight feedback reported three problems: clicking sometimes moves the cursor across the screen, the plain iPadOS pointer comes back (including after leaving and returning to the app), and the lock often drops, leaving the game unusable.
All three come from the same place. Every time the scene deactivated (app switch, Control Center, Notification Center, a system alert or banner, a screenshot), the page was force-unlocked, and any drop of the system lock did the same. The game then sat on its "click to resume" screen with the iPadOS pointer showing. That click landed wherever the pointer had been frozen, so the game's cursor jumped there.
What changes
__pointerLocker.suspend()releases held buttons (with no click) and held keys, but keeps the lock.prefersPointerLockedstays true, so iPadOS locks the pointer again when the app becomes active.resume()takes the lock back for the same element if the page dropped it while the app was away, since pages may exit on blur. It does not take back a release the user asked for (Esc, ⌘., three-finger tap) or a lock that ended with the button (Figma's scrub).lock-lostandlock-resumeentries, so Copy diagnostics in the next report shows what happened.Testing
npm testpasses, including five new polyfill tests for suspend and resume.Generated by Claude Code