From fbb10beb4094a1a5b9182b33f243a25f7388025d Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 31 Dec 2019 05:48:43 -0800 Subject: [PATCH] fix: highlight defaulted button correctly (#21642) --- shell/browser/ui/message_box_mac.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/message_box_mac.mm b/shell/browser/ui/message_box_mac.mm index 5e91015c30bc..cdfc4797f990 100644 --- a/shell/browser/ui/message_box_mac.mm +++ b/shell/browser/ui/message_box_mac.mm @@ -59,9 +59,11 @@ NSAlert* CreateNSAlert(const MessageBoxSettings& settings) { int button_count = static_cast([ns_buttons count]); if (settings.default_id >= 0 && settings.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. - // So remove that default, and make the requested button the default. + // Highlight the button at default_id + [[ns_buttons objectAtIndex:settings.default_id] highlight:YES]; + + // The first button added gets set as the default selected, so remove + // that and set the button @ default_id to be default. [[ns_buttons objectAtIndex:0] setKeyEquivalent:@""]; [[ns_buttons objectAtIndex:settings.default_id] setKeyEquivalent:@"\r"]; }