Browse Source

fix: highlight buttons correctly when defaultId passed (#22150)

Shelley Vohr 5 years ago
parent
commit
f27fde70ef
1 changed files with 3 additions and 1 deletions
  1. 3 1
      atom/browser/ui/message_box_mac.mm

+ 3 - 1
atom/browser/ui/message_box_mac.mm

@@ -61,7 +61,9 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
   int button_count = static_cast<int>([ns_buttons count]);
 
   if (default_id >= 0 && default_id < button_count) {
-    // Focus the button at default_id if the user opted to do so.
+    // Highlight the button at default_id
+    [[ns_buttons objectAtIndex:default_id] highlight:YES];
+
     // The first button added gets set as the default selected.
     // So remove that default, and make the requested button the default.
     [[ns_buttons objectAtIndex:0] setKeyEquivalent:@""];