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

WinForms - A window.confirm() dialog generated by this page was suppressed because this page is not the active tab #4976

Closed
1 task done
rustak opened this issue Nov 11, 2024 · 5 comments
Labels
upstream These issues require fixing in the Chromium Embedded Framework(CEF) or Chromium. winforms

Comments

@rustak
Copy link

rustak commented Nov 11, 2024

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

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.

@amaitland amaitland changed the title CefSharp with Chrome Bootstrap suppresses window.confirm() dialog when page is not the active tab WinForms - A window.confirm() dialog generated by this page was suppressed because this page is not the active tab Nov 22, 2024
@amaitland
Copy link
Member

CefSharp Version

126.2.180

Have you confirmed this exists in the current supported version? M130 at time of writing.

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.

The Alloy bootstrap was deprecated and removed. The Alloy styling is still supported and used by default.

@amaitland
Copy link
Member

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.

Testing with cef_binary_130.1.9+gfc42567+chromium-130.0.6723.70_windows64_client using

cefclient.exe --multi-threaded-message-loop --no-sandbox --use-alloy-style

Clicking on the Red confirm example logs the following to the console

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

Opening DevTools and then the dialog shows.

Behavior appears to be consistent with the MinimalExample.

Making this as upstream as the issue reproduces with cefclient.

@amaitland amaitland added the upstream These issues require fixing in the Chromium Embedded Framework(CEF) or Chromium. label Nov 22, 2024
@amaitland
Copy link
Member

Appears that chromiumembedded/cef#3818 is the correct upstream issue.

Closing as upstream

@amaitland amaitland closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
@amaitland
Copy link
Member

Testing with MinimalExample switching to Chrome Styled window appears to resolve the issue.

You can set the following before you create a ChromiumWebBrowser instance to switch to using Chrome Styled browsers in WinForms.

CefSharpSettings.RuntimeStyle = CefRuntimeStyle.Chrome;

@rustak
Copy link
Author

rustak commented Dec 4, 2024

Switching to a Chrome Styled window indeed resolved the issue. I was confused about RuntimeStyle and didn't realize that Alloy is used by default. Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream These issues require fixing in the Chromium Embedded Framework(CEF) or Chromium. winforms
Projects
None yet
Development

No branches or pull requests

2 participants