cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.88k stars 2.92k forks source link

CefSharp with Chrome Bootstrap suppresses window.confirm() dialog when page is not the active tab #4976

Open rustak opened 1 week ago

rustak commented 1 week ago

Is there an existing issue for this?

CefSharp Version

126.2.180

Operating System

Windows 10

Architecture

x64

.Net Version

.Net 4.8

Implementation

WinForms

Reproduction Steps

  1. In the test application CefSharp.WinForms.Example, open the following webpage: https://googlechrome.github.io/samples/block-modal-dialogs-sandboxed-iframe/
  2. Click on the red and blue window.confirm("Hello") buttons.

Expected behavior

A confirm dialog opens.

Actual behavior

The dialog does not open, and the following message appears in the status bar:

A window.confirm() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5140698722467840

Regression?

In version 124.x, this was working, likely because it still used the Alloy style by default.

Known Workarounds

If the Alloy style is used with CefSettings.ChromeRuntime = false, the dialog opens as expected.

However, Alloy style has another issue that can be resolved by upgrading to Chromium Runtime, and since it is now deprecated, I don’t consider this a valid workaround.

Does this problem also occur in the CEF Sample Application

No

Other information

I tested this in the Cef Sample application, and it worked fine there. The dialogs opened even when I ran cefclient.exe without the --use-alloy-style flag. Therefore, I believe this is not an issue with CEF itself, but with CefSharp.

However, I found similar issue here:

But I couldn't replicate it in the CEF sample application. The issue only occurs in CefSharp.WinForms.Example.