Disable DevTools context menu when debug mode is off (WebView2 backend) by atrox39 · Pull Request #1340 · webview/webview

This PR updates the Windows WebView2 backend to ensure that the context menu is disabled when the engine is running in non-debug mode.

ICoreWebView2Settings::put_AreDevToolsEnabled(false) alone does not prevent access to DevTools, since the default WebView2 runtime may still expose options through the browser context menu. By explicitly calling put_AreDefaultContextMenusEnabled(false) when debug == false, the WebView behaves more consistently with a locked-down runtime and reduces unintended entry points to inspection tools.

This change:

  • Keeps existing behavior in debug mode (no breaking changes).
  • Disables context menus only when DevTools are disabled.
  • Improves security and UX for kiosk-style or embedded applications that rely on restricted WebView environments.

No API changes were required; this is an internal backend improvement.