Skip to content

terminal: Don't steal focus from an open modal on background terminal startup - #60960

Merged
ChristopherBiscardi merged 1 commit into
zed-industries:mainfrom
apoorva-01:fix/terminal-no-focus-steal-modal
Jul 20, 2026
Merged

terminal: Don't steal focus from an open modal on background terminal startup#60960
ChristopherBiscardi merged 1 commit into
zed-industries:mainfrom
apoorva-01:fix/terminal-no-focus-steal-modal

Conversation

@apoorva-01

Copy link
Copy Markdown
Contributor

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

… startup

A center terminal can finish starting after the user has moved on to the
command palette or a picker; focusing it blurs the modal and closes it.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 14, 2026
@SomeoneToIgnore SomeoneToIgnore added area:integrations/terminal Feedback for terminal integration, shell commands, etc area:editor Feedback for code editing, formatting, editor iterations, etc area:pickers Everything related to pickers that are in a modal and removed area:integrations/terminal Feedback for terminal integration, shell commands, etc labels Jul 16, 2026

@ChristopherBiscardi ChristopherBiscardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue Jul 20, 2026
@ChristopherBiscardi ChristopherBiscardi self-assigned this Jul 20, 2026
Merged via the queue into zed-industries:main with commit 3f57e8d Jul 20, 2026
70 checks passed
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
… startup (zed-industries#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 zed-industries#60762.

Release Notes:

- Fixed a background terminal finishing startup closing the command
palette or an open picker
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
… startup (zed-industries#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 zed-industries#60762.

Release Notes:

- Fixed a background terminal finishing startup closing the command
palette or an open picker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:editor Feedback for code editing, formatting, editor iterations, etc area:pickers Everything related to pickers that are in a modal cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The terminal closes the CommandDialog/Picker/Palette

3 participants