Skip to content

Commit 92652fb

Browse files
authored
Merge pull request #2125 from Eitot/feature/destructive-action-highlighting
Enable hasDestructiveAction property of certain NSAlert buttons On some alerts that are triggered by pressing the delete key, highlight the "Delete" buttons in red instead of the accent colour (on macOS 11+).
2 parents c9f091e + 53f88da commit 92652fb

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Vienna/Sources/Application/AppController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,9 @@ -(IBAction)deleteFolder:(id)sender
20382038
NSBundle.mainBundle,
20392039
@"Delete",
20402040
@"Title of a button on an alert")];
2041+
if (@available(macOS 11, *)) {
2042+
alert.buttons.lastObject.hasDestructiveAction = YES;
2043+
}
20412044
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
20422045
nil,
20432046
NSBundle.mainBundle,

Vienna/Sources/Main window/ArticleController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,9 @@ - (IBAction)delete:(nullable id)sender
11671167
NSBundle.mainBundle,
11681168
@"Delete",
11691169
@"Title of a button on an alert")];
1170+
if (@available(macOS 11, *)) {
1171+
alert.buttons.lastObject.hasDestructiveAction = YES;
1172+
}
11701173
[alert addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"cancel.button",
11711174
nil,
11721175
NSBundle.mainBundle,

0 commit comments

Comments
 (0)