electron: dialog.showMessageBoxSync defaultId not work under windows OS.
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- 8.0.0
- Operating System:
- Windows 10 (18362)
- Ubuntu 14.04 x64
- Last Known Working Electron version:
Expected Behavior
dialog.showMessageBoxSync(null, { type:'warning', buttons: ['Yes', 'No'], defaultId: 1, cancelId: 1, title: 'Power Control', message: "Warning!", });
I set “defaultId:1”, after executing the function,it should focus on the “No” button.
Actual Behavior
Execute the function, in windows 10, it focuses on the “Yes” button. And it focuses on the “No” button in Ubuntu 14.04.
To Reproduce
$ git clone git@github.com:ForJason/electron-smt.git
$ cd electron-smt
$ npm start
Screenshots

Additional Information
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 22 (6 by maintainers)
Confirming that it still doesn’t work as expected
The
defaultIdis simply ignored.bump
bump
bump
On Fri, Oct 7, 2022, 10:20 PM github-actions[bot] @.***> wrote:
I see
defaultIdworking even withnoLink: true.This repros with Electron 12.0.1. If you explicitly set
noLinktofalse, the issues goes away.YesandNobuttons seems to be defaulting to the no link display. If you change the labels, it will also work, but will look like this (which is where thenoLinkproperty comes in):