fix: don't close dialog when drag-selecting text out of modal - #247
Conversation
Track where the press started — only close on backdrop click if the mousedown also originated on the backdrop. Previously, selecting text inside a textarea and releasing the mouse outside the dialog would fire a click on the dialog element and dismiss the modal. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @diegoimbert's task in 55s —— View job Code Review — PR #247
Verdict: Looks good. The fix correctly addresses the bug and is appropriately minimal. Why the fix is correctThe browser fires a synthetic
The flag can never go stale across gestures: every Minor notes (non-blocking)
Style / TSEvent handlers are explicitly typed as Nice, well-scoped fix. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
webmux | 92a611a | Commit Preview URL Branch Preview URL |
May 20 2026, 09:41 AM |
|
Claude finished @diegoimbert's task in 1m 16s —— View job Code Review — PR #247
Verdict: Looks good — correct, minimal, and safe to merge. Why the fix is correctA
No staleness risk: every Notes (all non-blocking)
Style / TSEvent handlers explicitly typed as |
Summary
The "New worktree" modal (and any other
BaseDialogconsumer) closes when the user mousedowns inside a textarea/input, drags the pointer outside the dialog, and releases — a common gesture when selecting prompt text with the mouse. The browser fires a syntheticclickon the<dialog>element (the common ancestor of mousedown/mouseup), which the existing handler interprets as a backdrop click.Changes
BaseDialog.svelte: track anonmousedownflag indicating whether the press originated on the backdrop. Theonclickhandler now only closes the dialog when both the click target and the original mousedown target are the dialog element itself.Test plan
Generated with Claude Code