Skip to content

Prevent dev container modal dismissal during creation#52506

Merged
KyleBarton merged 2 commits intozed-industries:mainfrom
antont:fix-devcontainer-modal-dismiss
Apr 6, 2026
Merged

Prevent dev container modal dismissal during creation#52506
KyleBarton merged 2 commits intozed-industries:mainfrom
antont:fix-devcontainer-modal-dismiss

Conversation

@antont
Copy link
Copy Markdown
Contributor

@antont antont commented Mar 26, 2026

Context

When the dev container creation modal is showing "Creating Dev Container", clicking anywhere on the workspace backdrop dismisses the dialog. The container creation continues in the background, but the user loses visual feedback and the subsequent open_remote_project call may fail because the modal entity is gone.

This adds an allow_dismissal flag to RemoteServerProjects that blocks accidental dismissal (backdrop clicks, focus loss) while a dev container is being created, but allows explicit dismissal on success or error.

How to Review

Small PR — two files changed:

  1. remote_servers.rs (the fix): allow_dismissal bool field added, set to false when entering Creating state, set to true before emitting DismissEvent on success/error. on_before_dismiss override checks the flag.
  2. recent_projects.rs (the test): Regression test that opens a dev container modal, simulates a backdrop click, and asserts the modal stays open.

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed dev container creation modal being dismissed when clicking outside it
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 26, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 26, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested review from a team, cameron1024 and reflectronic and removed request for a team March 26, 2026 15:15
@KyleBarton
Copy link
Copy Markdown
Collaborator

Hi @antont thanks for this change - mind merging main and addressing the failing test here? Otherwise, this approach looks sound and works as expected when I test. We should be good to merge once CI is green. Thanks!

antont and others added 2 commits April 6, 2026 19:34
The test opens a dev container modal with a single config (which
immediately enters the "Creating" state), then simulates a click
outside the modal on the backdrop. Without a fix, the modal is
dismissed, losing visual feedback while creation continues in the
background.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add an allow_dismissal flag to RemoteServerProjects that is:
- Set to false when entering Creating state (blocks accidental dismissal)
- Set to true before emitting DismissEvent on success (allows explicit dismissal)
- Set to true on error (allows user interaction with error UI)

Override on_before_dismiss to check this flag, preventing backdrop
clicks and focus loss from dismissing the modal while a dev container
is being created.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antont antont force-pushed the fix-devcontainer-modal-dismiss branch from ff2aca4 to e61fdfb Compare April 6, 2026 16:40
@antont
Copy link
Copy Markdown
Contributor Author

antont commented Apr 6, 2026

@KyleBarton - cool! It went with clean rebase from current main and then tests passed, at least the failing one (test_open_dev_container_action_with_single_config) and recent_projects.

@KyleBarton KyleBarton requested review from KyleBarton April 6, 2026 17:16
@KyleBarton
Copy link
Copy Markdown
Collaborator

Thanks again!

@KyleBarton KyleBarton merged commit f3c034e into zed-industries:main Apr 6, 2026
30 checks passed
@zed-zippy zed-zippy Bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 7, 2026
@dinocosta dinocosta removed the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 8, 2026
piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
…#52506)

## Context

When the dev container creation modal is showing "Creating Dev
Container", clicking anywhere on the workspace backdrop dismisses the
dialog. The container creation continues in the background, but the user
loses visual feedback and the subsequent `open_remote_project` call may
fail because the modal entity is gone.

This adds an `allow_dismissal` flag to `RemoteServerProjects` that
blocks accidental dismissal (backdrop clicks, focus loss) while a dev
container is being created, but allows explicit dismissal on success or
error.

## How to Review

Small PR — two files changed:

1. **`remote_servers.rs`** (the fix): `allow_dismissal` bool field
added, set to `false` when entering Creating state, set to `true` before
emitting `DismissEvent` on success/error. `on_before_dismiss` override
checks the flag.
2. **`recent_projects.rs`** (the test): Regression test that opens a dev
container modal, simulates a backdrop click, and asserts the modal stays
open.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed dev container creation modal being dismissed when clicking
outside it

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

4 participants