Prevent built-in screenshot tool
What happened?
In windows 11, using WebView2 version 1.0.3065.39, by default, the key combination CTRL+SHIFT+S pulls up the built-in screenshot tool. This is not ideal when embedding the webview2 into a WinForms.
I searched for a chromium flag to pass while creating a CoreWebView2EnvironmentOptions instance, but couldn't find any.
I already have AreBrowserAcceleratorKeysEnabled = false, and it works for everything else.
ChatGPT also suggests intercepting that key combination in the AcceleratorKeyPressed event, but it's not available in the WinForms implementation.
Is there any way to inhibit the tool from appearing?
Thank you.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
1.0.3065.39
SDK Version
No response
Framework
Winforms
Operating System
Windows 11
OS Version
No response
Repro steps
Press CTRL+SHIT+S
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
@AndreaLabeljoy, if I am not wrong you are asking for the feature to prevent screenshot tool?
@sivMSFT Not sure if this is a feature request, I'm asking if there already is a way to prevent the screenshot tool. If there isn't I'll gladly change this to a feature request.
But considering that AreBrowserAcceleratorKeysEnabled = false should prevent ALL shortcuts from being executed, I'm inclined to think that this is a bug or at least an oversight.
FWIW, the documentation on differences between Microsoft Edge and WebView2 includes Web Capture (CTRL+SHIFT+S) in a list of shortcuts that are always turned off and indicates that the feature itself is either turned off or not applicable to WebView2. So I don't think this is a bug with AreBrowserAcceleratorKeysEnabled (which has a separate list of shortcuts on the same page) or a feature request, but a bug with WebView2 in general.
Can relate, got the same issue. While my AreBrowserAcceleratorKeysEnabled = false I still get the screenshot built-in tool only when my webview2 have a lot of information and lag.
@AndreaLabeljoy , @NewNekoy , this is a bug in WebView2 due to which the keyboard shortcut for the screenshot feature was not disabled. It has been fixed in version >= 138.0.3332.0, expected to go to in Stable in week of 26-Jun-2025. Please let me know if this resolves the issue.
@NewNekoy, Great news! Is there a NuGet package out there already containing the fix, so we can test it?
Thank you.
This is a change in WebView2 runtime, so you can test your app with the latest Edge Dev\Canary. Follow instructions here: Self-host by deploying preview channels
The issue is now resolved. Thank you all.