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

dialog.showMessageBox doesn't respect defaultId option on Windows #18258

Closed
3 tasks done
laurent22 opened this issue May 11, 2019 · 2 comments
Closed
3 tasks done

dialog.showMessageBox doesn't respect defaultId option on Windows #18258

laurent22 opened this issue May 11, 2019 · 2 comments

Comments

@laurent22
Copy link

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:
    • v4.1.4
  • Operating System:
    • Windows 10

Expected Behavior

I've created some simple code to replicate the issue:

const { dialog } = require('electron');
const options = {
	type: 'question',
	message: 'Delete this note?',
	cancelId: 1,
	defaultId: 1,
	buttons: [ 'Delete', 'Cancel' ],
}
const result = dialog.showMessageBox(window, options);
console.info('This button was pressed: ' + result);

When the dialog shows up, the "Cancel" button should be selected by default since defaultId is set to 1. However, the default button is "Delete". This is confirmed by pressing Enter - in that case the message This button was pressed: 0 is displayed.

Capture

Actual Behavior

Instead of selecting Cancel by default it is selecting Delete, as if the defaultId option was ignored.

@MarshallOfSound
Copy link
Member

This was fixed in #17547 and backport to 5-0-x. Can you upgrade to that version and test it out. If the same issue occurs please @ mention me in a follow up comment below and I can re-open 👍

@Andrew-web-coder
Copy link

@MarshallOfSound I don't see any fixes in the latest version of Electron, it works as described by the original author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants