-
-
Notifications
You must be signed in to change notification settings - Fork 736
Closed
Labels
Description
-
Version: 13.5.1
-
Target: windows
If you set BrowserWindowOptions.Modal = true when creating a new BrowserWindow, the created window will not be a modal window even after setting the parent.
Consider this code:
var parent = Electron.WindowManager.BrowserWindows.First(); // assume a main window exists and this returns it
var child = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions
{
Show = false,
Modal = true
});
child.SetParentWindow(parent);
child.OnReadyToShow += () =>
{
child.Show();
}
child.OnShow += async () =>
{
var isModal = await child.IsModalAsync();
}The observed behavior of the child window is that it is NOT a modal window, and you can still interact with the main window (parent). The value of isModal in the OnShow handler is false, too.
I haven't investigated this, but it's possible that for modal windows to work the parent must be set inside the BrowserWindowOptions: https://www.electronjs.org/docs/latest/api/browser-window/#modal-windows