mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
fix: focus rings with multiple buttons in showMessageBox (#36772)
fix: focus rings with multiple buttons in messageBox
This commit is contained in:
@@ -71,9 +71,6 @@ NSAlert* CreateNSAlert(const MessageBoxSettings& settings) {
|
||||
int button_count = static_cast<int>([ns_buttons count]);
|
||||
|
||||
if (settings.default_id >= 0 && settings.default_id < button_count) {
|
||||
// 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:@""];
|
||||
@@ -86,6 +83,11 @@ NSAlert* CreateNSAlert(const MessageBoxSettings& settings) {
|
||||
[[ns_buttons objectAtIndex:settings.cancel_id] setKeyEquivalent:@"\e"];
|
||||
}
|
||||
|
||||
// TODO(@codebytere): This behavior violates HIG & should be deprecated.
|
||||
if (settings.cancel_id >= 0 && settings.cancel_id == settings.default_id) {
|
||||
[[ns_buttons objectAtIndex:settings.default_id] highlight:YES];
|
||||
}
|
||||
|
||||
if (!settings.checkbox_label.empty()) {
|
||||
alert.showsSuppressionButton = YES;
|
||||
alert.suppressionButton.title =
|
||||
|
||||
Reference in New Issue
Block a user