I'm learning Electron and trying very basic things... without success.
Whatever the technique I use to make a dialog box modal, it fails. Either the dialog box is not modal, or the dialog box is empty (...and still not modal).
const {BrowserWindow, dialog} = require('electron')
dialog.showMessageBoxSync(BrowserWindow.getFocusedWindow(), {message: "FooBar"});
// Not modal: BrowserWindow.getFocusedWindow() returns null.
dialog.showMessageBoxSync(BrowserWindow.getAllWindows()[0], {message: "FooBar"});
// Not modal: BrowserWindow.getAllWindows() returns an empty array.
dialog.showMessageBoxSync(parentWindow, {message: "FooBar"});
// "parentWindow" comes from the "click" handler of the menu item launching the message box: it is not null.
// Error: the message box is not modal, and does not display "FooBar" (i.e. it is empty).
This code is called from the main process, and no error is displayed in the terminal or the development tools. The outcome is the same if I use dialog.showMessageBox() instead of showMessageBoxSync().
Electron: v9.0.5 on Windows 10 (x64).