New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pointer lock escape handling #32369
Conversation
d5e63f4
to
19387ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @nornagon -- we should maintain the call to WebContentsPermissionHelper::RequestPermission as it provides a way for Electron devs to manage pointer lock permissioning.
19387ca
to
c1e9d5f
Compare
@jkleinsc @nornagon i refactored this to split the difference - it now still allows for control via Chromium itself never asks for explicit permissions on this front - instead it decides based on the following comment whether to grant permission. While this new behavior still ultimately diverges from Chrome's own, i think in light of maintaining backwards compat as well as for improved permissions control this hybrid approach is likely our best bet for serving user and dev needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess so. I rather expect that in a few months we'll get a bug report like "no way to prevent Esc from exiting pointer lock", but I suppose we can address that when it comes up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b24d80d
to
77b0107
Compare
77b0107
to
79d3e0a
Compare
Merging as failure is unrelated and a CircleCI infra issue. |
Release Notes Persisted
|
I have automatically backported this PR to "16-x-y", please check out #32826 |
I have automatically backported this PR to "17-x-y", please check out #32827 |
I have automatically backported this PR to "18-x-y", please check out #32828 |
# Conflicts: # shell/browser/api/electron_api_web_contents.cc # shell/browser/api/electron_api_web_contents.h
@codebytere This PR makes the " tag requestFullscreen from webview pressing ESC should emit the leave-html-full-screen event" test fail on mac arm64 CI. I think it is not a flaky since this PR has code handling ESC key. I'm not sure why the test passes on x64 CI though, it is probably related to macOS version or SDK version. |
Description of Change
Fixes an issue where the Pointer Lock API could be properly engaged but not disengaged. We were not properly routing requests through the
ExclusiveAccessManager
nor handling special override keys for exclusive access inWebContents::PreHandleKeyboardEvent
. As of this change, this demo works identically to Chrome.cc @nornagon @jkleinsc
Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where Pointer Lock behavior could not be properly exited.