feat: focus delete in note confirmation

This commit is contained in:
2026-10-19 19:50:41 +02:00
parent 63d0387339
commit 090c9045a4
3 changed files with 11 additions and 5 deletions
+6 -2
View File
@@ -517,8 +517,12 @@ final class NotesController: NSViewController, NSTextViewDelegate {
alert.alertStyle = .warning
alert.messageText = "Delete “\(noteTitle.stringValue)”?"
alert.informativeText = "This permanently deletes the note and its embedded images. This cannot be undone."
alert.addButton(withTitle: "Cancel")
alert.addButton(withTitle: "Delete Note").hasDestructiveAction = true
alert.addButton(withTitle: "Cancel").keyEquivalent = "\u{1b}"
let delete = alert.addButton(withTitle: "Delete Note")
delete.contentTintColor = .systemRed
delete.keyEquivalent = "\r"
alert.window.initialFirstResponder = delete
alert.window.defaultButtonCell = delete.cell as? NSButtonCell
alert.beginSheetModal(for: window) { [weak self] response in
guard let self else { return }
defer { self.focusEditor() }