Skip to content

Commit e45ea88

Browse files
authored
🤖 fix: prevent new workspace modal from closing on outside click (#65)
## Changes Fixes the new workspace modal behavior so it only closes via explicit user actions (Cancel button, Create Workspace button, or Escape key), not by clicking outside the modal. ## Problem Previously, clicking anywhere on the overlay (dark background) would close the modal, which could lead to accidental dismissal when users are filling out the form. ## Solution Removed: - `onClick={handleCancel}` from `ModalOverlay` - `onClick={(e) => e.stopPropagation()}` from `ModalContent` The modal now only closes through: 1. Clicking the Cancel button 2. Clicking Create Workspace (after successful creation) 3. Pressing Escape key (via existing keybind handler) ## Testing Manual testing needed: 1. Open the new workspace modal 2. Click outside the modal (on the overlay) - should NOT close 3. Click Cancel - should close 4. Open modal again and press Escape - should close 5. Create a workspace successfully - should close _Generated with `cmux`_
1 parent ec7efb5 commit e45ea88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/NewWorkspaceModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ const NewWorkspaceModal: React.FC<NewWorkspaceModalProps> = ({
201201
const projectName = projectPath.split("/").pop() ?? projectPath.split("\\").pop() ?? "project";
202202

203203
return (
204-
<ModalOverlay onClick={handleCancel}>
205-
<ModalContent onClick={(e) => e.stopPropagation()}>
204+
<ModalOverlay>
205+
<ModalContent>
206206
<h2>New Workspace</h2>
207207
<ModalSubtitle>Create a new workspace for {projectName}</ModalSubtitle>
208208

0 commit comments

Comments
 (0)