macOS: order out alert sheets to avoid Stage Manager focus loss

Signed-off-by: Moeeze Hassan <fammas.maz@gmail.com>
pull/8348/head
Moeeze Hassan 2025-08-22 13:11:05 +02:00 committed by Mitchell Hashimoto
parent 298f11166d
commit f4009721a1
2 changed files with 7 additions and 0 deletions

View File

@ -290,8 +290,12 @@ class BaseTerminalController: NSWindowController,
alert.addButton(withTitle: "Cancel")
alert.alertStyle = .warning
alert.beginSheetModal(for: window) { response in
let alertWindow = alert.window
self.alert = nil
if response == .alertFirstButtonReturn {
// This is important so that we avoid losing focus when Stage
// Manager is used (#8336)
alertWindow.orderOut(nil)
completion()
}
}

View File

@ -747,6 +747,9 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
alert.alertStyle = .warning
alert.beginSheetModal(for: alertWindow, completionHandler: { response in
if (response == .alertFirstButtonReturn) {
// This is important so that we avoid losing focus when Stage
// Manager is used (#8336)
alert.window.orderOut(nil)
closeAllWindowsImmediately()
}
})