Skip to content

Studio: hold the sidebar drag escape click guard until the button comes up - #11568

Merged
shimmyshimmer merged 1 commit into
mainfrom
studio-drag-escape-click-guard
Sep 22, 2026
Merged

shimmyshimmer merged 1 commit into
mainfrom
studio-drag-escape-click-guard

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

Follow-up to #11373 and #11561, which is already merged. Codex found this on #11561 after it landed, so it comes as its own PR.

The bug

Escape cancels a drag, but the button is usually still down when it is pressed. swallowClick armed a capture-phase click listener and removed it on a zero-delay timer, so by the time the user actually let go, the guard was long gone. Releasing over the row the drag started on opened that chat, or toggled that folder, straight after cancelling out of the drag.

The same guard is correct on the drop path, where the release is what calls it and the click follows immediately.

The fix

Escape no longer ends the gesture. It marks it escaped, clears the drag, and leaves the pointer listeners in place, so the release, whenever it comes, is still ours: that is what detaches, swallows the click, and returns without a drop. A move after escape is ignored, so a cancelled drag cannot come back to life under a pointer that keeps travelling.

Escape before the threshold is unchanged and still abandons the press outright. Nothing was lifted, so a click after it belongs to the row.

Tests

npm run test passes 8469. sidebar-row-drag.test.ts covers the release owning the swallow, escape not detaching while the button is down, and a move after escape staying inert.

Escape cancels while the button is still down, and the release comes
later. The guard was armed at the keypress and torn down on the next
tick, so releasing over the source row opened the chat the drag had just
been cancelled out of.

The gesture keeps its listeners through escape now. The release is what
detaches, swallows the click and, being escaped, drops nothing.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T17:57:33.931513Z fae416d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: fae416dddc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit be072ee into main Sep 22, 2026
2 of 47 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-drag-escape-click-guard branch September 22, 2026 17:57
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
Escape cancels while the button is still down, and the release comes
later. The guard was armed at the keypress and torn down on the next
tick, so releasing over the source row opened the chat the drag had just
been cancelled out of.

The gesture keeps its listeners through escape now. The release is what
detaches, swallows the click and, being escaped, drops nothing.

Co-authored-by: Unsloth <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant