Skip to content

Hide cursor while dragging number inputs in Safari to approximate PointerLock, and disable it on desktop - #3425

Merged
Keavon merged 2 commits into
masterfrom
conditional-pointerlock
Nov 27, 2025
Merged

Keavon merged 2 commits into
masterfrom
conditional-pointerlock

Conversation

@Keavon

@Keavon Keavon commented Nov 27, 2025

Copy link
Copy Markdown
Member

This PR, more properly this time, fixes #2038.

@github-actions
github-actions Bot temporarily deployed to graphite-dev (Preview) November 27, 2025 02:25 Inactive
@github-actions
github-actions Bot temporarily deployed to graphite-dev (Preview) November 27, 2025 04:21 Inactive
@Keavon
Keavon force-pushed the conditional-pointerlock branch from ce2e594 to 65bdcd7 Compare November 27, 2025 05:16
@github-actions
github-actions Bot temporarily deployed to graphite-dev (Preview) November 27, 2025 05:20 Inactive
@Keavon
Keavon force-pushed the conditional-pointerlock branch from 65bdcd7 to bee33d7 Compare November 27, 2025 06:14
@Keavon Keavon changed the title Pointerlock Hide cursor while dragging number inputs on Safari to approximate PointerLock, and disable it on desktop Nov 27, 2025
@github-actions
github-actions Bot temporarily deployed to graphite-dev (Preview) November 27, 2025 06:18 Inactive
@Keavon

Keavon commented Nov 27, 2025

Copy link
Copy Markdown
Member Author

For future reference: if we try to enable pointerlock during the pointermove event, we get the exception "Pointer lock requires a user gesture." which is a result of the "engagement gesture" requirement that existed in the 2016 version of this spec (https://www.w3.org/TR/2016/REC-pointerlock-20161027/#glossary) but is no longer a factor in spec-complaint browsers (Chrome and Firefox). Source code for that exception: https://github.com/WebKit/WebKit/blob/982c9baee3b84661bb70d26ccf0067001572819e/Source/WebCore/page/PointerLockController.cpp#L90

Safari also chooses to push all content in the page down, causing a resize of the whole web app, when showing its dialog which is another reason we can't use the pointerlock API.

@Keavon Keavon changed the title Hide cursor while dragging number inputs on Safari to approximate PointerLock, and disable it on desktop Hide cursor while dragging number inputs in Safari to approximate PointerLock, and disable it on desktop Nov 27, 2025
@Keavon
Keavon force-pushed the conditional-pointerlock branch from bee33d7 to 172dbec Compare November 27, 2025 06:24
@github-actions
github-actions Bot temporarily deployed to graphite-dev (Preview) November 27, 2025 06:30 Inactive
@Keavon
Keavon merged commit ab5c87f into master Nov 27, 2025
3 checks passed
@Keavon
Keavon deleted the conditional-pointerlock branch November 27, 2025 08:13
@timon-schelling

Copy link
Copy Markdown
Member

This did not fix the desktop (mac) part fully.
I included the necessary change in #3424.
See 23dbde4 for explanation.

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.

Click-and-drag number fields can't be released in Safari

2 participants