WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

Prevent built-in screenshot tool

Open AndreaLabeljoy opened this issue 10 months ago • 2 comments

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 avatar Mar 11 '25 15:03 AndreaLabeljoy

@AndreaLabeljoy, if I am not wrong you are asking for the feature to prevent screenshot tool?

sivMSFT avatar Mar 12 '25 12:03 sivMSFT

@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.

AndreaLabeljoy avatar Mar 12 '25 12:03 AndreaLabeljoy

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.

jakelazaroff avatar Apr 30 '25 15:04 jakelazaroff

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.

NewNekoy avatar May 27 '25 08:05 NewNekoy

@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.

gourabkmsft avatar May 27 '25 09:05 gourabkmsft

@NewNekoy, Great news! Is there a NuGet package out there already containing the fix, so we can test it?

Thank you.

AndreaLabeljoy avatar May 27 '25 10:05 AndreaLabeljoy

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

gourabkmsft avatar May 27 '25 10:05 gourabkmsft

The issue is now resolved. Thank you all.

AndreaLabeljoy avatar Jul 08 '25 12:07 AndreaLabeljoy