terminal: Don't steal focus from an open modal on background terminal startup (#60960)
the startup terminal can take a sec to come up if your shell is slow.
when it's ready it grabs focus, and if you've opened the command palette
by then, that blurs the palette input and closes it. so it just
vanishes.
`add_center_terminal` focused the new terminal unconditionally. now it
skips the focus if a modal is open (`!has_active_modal`). one line at
the definition, covers all the call sites.
kept it terminal-specific like dinocosta framed it. could do a broader
workspace-level "don't steal from a modal" instead if you'd prefer.
two tests: modal stays focused after a background terminal spawns (fails
without the fix), and no-modal still focuses the terminal like before.
Fixes #60762.
Release Notes:
- Fixed a background terminal finishing startup closing the command
palette or an open picker
3f57e8d17dApoorva Verma committed on 7/20/2026, 5:42:44 AM· committed by GitHubparent777aa2e