fix(web): keep modal open when a drag releases outside the dialog (#222) - #223
Open
CPPavithra wants to merge 2 commits into
Open
fix(web): keep modal open when a drag releases outside the dialog (#222)#223CPPavithra wants to merge 2 commits into
CPPavithra wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 91 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #222 — the New Project dialog closes if you select the name and release the mouse outside the dialog.
The issue: The backdrop dismissed on
onClick={onClose}, and the panel guarded itself withstopPropagation. That guard can't work: aclickfires on the common ancestor of its mousedown and mouseup targets, so a drag from inside the dialog to the backdrop produces a click targeting the backdrop, and the event never passes through the panel.The fix: Dismissal now keys off
mousedown/mouseupand closes only when both ends land on the backdrop. The panel'sstopPropagationbecame dead code and was removed.onMouseUpalso needed ane.button !== 0guard as mouseup fires for every button, so a right-click would otherwise dismiss the dialog.Tests: New
Modal.test.tsxcovers seven gestures. Two fail onmain- the drag-out case from the issue and its mirror (press backdrop → release inside). The right-click case passes onmainand guards against the regression the fix itself could introduce.Also verified by hand: reproduced on
main, confirmed fixed hereSummary by cubic
Keeps the modal open when a drag starts inside the dialog and releases on the backdrop (#222). Previously the backdrop closed on click; now it closes only when both mousedown and mouseup land on the backdrop with a left-click, and we clear the pending press on non-primary mouseup to avoid stray dismissals.
web-v2/src/components/ui/Modal.tsx: Replace backdroponClickwithonMouseDown/onMouseUp, track the press start target, guard withbutton === 0, and clear the tracked press on any mouseup so right-clicks never trigger a later close.web-v2/src/components/ui/Modal.test.tsx: New tests cover seven pointer gestures; drag-out and its mirror fail onmainand pass here; right-click is ignored and does not dismiss.Rollout / QA
Written for commit b0bca60. Summary will update on new commits.