Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] fix: Closing tab with running process while in Stage Manager no longer causes focus to be lost #5164

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xalbd
Copy link

@xalbd xalbd commented Jan 16, 2025

Resolves #5108

Reproduction: While Stage Manager is activated, create a new tab in Ghostty, run sleep 500 in that tab, and try and close it. Make sure to try both closing the tab with cmd-w and clicking the x; also try accepting the modal with a mouse click and pressing enter.

Relevant AppKit documentation: NSAlert beginSheetModal

What I believe is happening is that the alert modal ("there is still a process running") is closed automatically after the completion handler is run, which closes the window on which the alert is attached. Something seems to go wrong in Stage Manager at this point; perhaps it detects the alert closing as a "full" window closing and moves focus to a different window.

The fix I've identified is to manually call the orderOut function to dismiss the alert before the code that closes the window is run.

Allowing the alert to be automatically closed after the completion handler finishes doesn't seem to play well when the completion handler closes the window on which the alert is attached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MacOS: Closing tab causes window to lose focus when Stage Manager is enabled.
2 participants