Skip to content
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

Prevent F1 from opening browser help in webviews #204499

Merged
merged 3 commits into from Feb 6, 2024

Conversation

a-stewart
Copy link
Contributor

This fixes #162166 and #174569

When in VS Code (web) pressing F1 does not trigger the browser help normally, but it does when in a webview.

Preventing this just requires us to call preventDefault on the event, the same as for ctrl+w and ctrl+n.

@a-stewart
Copy link
Contributor Author

a-stewart commented Feb 6, 2024

TODO - need to update the sha hashes for CSP...

Updated.

@VSCodeTriageBot VSCodeTriageBot added this to the February 2024 milestone Feb 6, 2024
@mjbvz mjbvz enabled auto-merge (squash) February 6, 2024 18:44
@mjbvz
Copy link
Contributor

mjbvz commented Feb 6, 2024

Thanks!

@mjbvz mjbvz merged commit e0ae0f3 into microsoft:main Feb 6, 2024
6 checks passed
*/
function isRefresh(e) {
// 116: keyCode of "F5"
return e.keyCode === 116;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the keyCode property being deprecated, in favor of using the KeyboardEvent.code property?

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.

F1 when webview is focused opens google help instead of VSCode command palette
5 participants