diff --git a/atom/browser/ui/message_box_mac.mm b/atom/browser/ui/message_box_mac.mm index a29ebff7bead..ee2f59dc8c84 100644 --- a/atom/browser/ui/message_box_mac.mm +++ b/atom/browser/ui/message_box_mac.mm @@ -97,11 +97,6 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window, NSArray* ns_buttons = [alert buttons]; int button_count = static_cast([ns_buttons count]); - // Bind cancel id button to escape key if there is more than one button - if (button_count > 1 && cancel_id >= 0 && cancel_id < button_count) { - [[ns_buttons objectAtIndex:cancel_id] setKeyEquivalent:@"\e"]; - } - if (default_id >= 0 && default_id < button_count) { // Focus the button at default_id if the user opted to do so. // The first button added gets set as the default selected. @@ -110,6 +105,11 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window, [[ns_buttons objectAtIndex:default_id] setKeyEquivalent:@"\r"]; } + // Bind cancel id button to escape key if there is more than one button + if (button_count > 1 && cancel_id >= 0 && cancel_id < button_count) { + [[ns_buttons objectAtIndex:cancel_id] setKeyEquivalent:@"\e"]; + } + if (!checkbox_label.empty()) { alert.showsSuppressionButton = YES; alert.suppressionButton.title = base::SysUTF8ToNSString(checkbox_label);