From df4b5f4ede3b6aa1d092bfe21216bb3309a5d513 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 7 Jul 2015 18:45:43 +0800 Subject: [PATCH] On OS X the "Cancel" is always get selected when dialog is cancelled --- atom/browser/api/lib/dialog.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/atom/browser/api/lib/dialog.coffee b/atom/browser/api/lib/dialog.coffee index 3dbd80a25ef3..6ee334e29a53 100644 --- a/atom/browser/api/lib/dialog.coffee +++ b/atom/browser/api/lib/dialog.coffee @@ -93,6 +93,7 @@ module.exports = options.detail ?= '' options.icon ?= null + # Choose a default button to get selected when dialog is cancelled. unless options.cancelId? options.cancelId = 0 for text, i in options.buttons @@ -100,6 +101,12 @@ module.exports = options.cancelId = i break + # On OS X the "Cancel" is always get selected when dialog is cancelled. + if process.platform is 'darwin' + for text, i in options.buttons when text is 'Cancel' + options.cancelId = i + break + binding.showMessageBox messageBoxType, options.buttons, options.cancelId,