fix: Prevent sidebar project dragging when using macos control+click to open context menu#873
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6ab08cf to
09bd3aa
Compare
32f802c to
44f8826
Compare
|
@juliusmarminge not sure what the deal is with the browser test stage failing, seems to be failing on other people's PR's too https://github.com/pingdotgg/t3code/actions/runs/22935708344/job/66566456827?pr=882 |
|
@macroscope-app review this |
- Add shared context-menu pointerdown detection logic with unit tests - Stop propagation on right-click/Ctrl-click to avoid arming drag sensors - Suppress the follow-up project title click when opening the project context menu
ff700af to
ac752db
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Add tests for secondary-button and macOS ctrl-click gestures - Keep context-menu pointer handling aligned with platform behavior

What Changed
Updated the drag handler to ignore control+click actions when starting dragging.
Why
When using my trackpad on my MacBook, I was running into issues right clicking projects (while testing other stuff), because I was using the control+click method of triggering a right click.
This was causing the app to begin the drag state for a project when the context menu was dismissed, instead of just triggering the context menu.
UI Changes
The UI changes were kind of hard to show, but in all examples I did a normal drag, then a normal control+click and either clicked away or pressed esc to close the context menu, then moved my cursor (so not holding down click).
In the before, it kept the click action in a drag state even though I had let go of left click.
Before
Screen.Recording.2026-03-11.at.1.13.43.PM.mov
Screen.Recording.2026-03-11.at.1.14.37.PM.mov
After
Screen.Recording.2026-03-11.at.1.12.11.PM.mov
Screen.Recording.2026-03-11.at.1.11.11.PM.mov
Checklist
Note
Prevent sidebar project dragging and expand/collapse on macOS ctrl+click context menu
isContextMenuPointerDownin Sidebar.logic.ts to detect context menu gestures: secondary button (all platforms) or ctrl+primary-click (macOS only).handleProjectTitlePointerDownCapturestops propagation when a context menu gesture is detected, preventing the drag sensor from arming.suppressProjectClickForContextMenuRefref gates the subsequent synthetic click so it does not toggle the project's expanded state.Macroscope summarized b510ba5.
Note
Low Risk
Low risk UI interaction change localized to sidebar project header pointer/click handling; main risk is unintended suppression of legitimate clicks/drags on some platforms.
Overview
Prevents sidebar project rows from entering (or staying in) a drag/click state when opening the project context menu via right-click or macOS ctrl+click.
Adds
isContextMenuPointerDownto detect context-menu pointer gestures, stops pointer event propagation during capture to avoid arming the@dnd-kitdrag sensor, and suppresses the follow-up click so context-menu dismissal doesn’t toggle project expand/collapse. Includes unit tests for the new context-menu detection logic.Written by Cursor Bugbot for commit b510ba5. This will update automatically on new commits. Configure here.