Skip to content

fix: Prevent sidebar project dragging when using macos control+click to open context menu#873

Merged
juliusmarminge merged 5 commits intopingdotgg:mainfrom
Noojuno:t3code/debug-sidebar-context-drag-mode
Mar 28, 2026
Merged

fix: Prevent sidebar project dragging when using macos control+click to open context menu#873
juliusmarminge merged 5 commits intopingdotgg:mainfrom
Noojuno:t3code/debug-sidebar-context-drag-mode

Conversation

@Noojuno
Copy link
Copy Markdown
Contributor

@Noojuno Noojuno commented Mar 11, 2026

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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Prevent sidebar project dragging and expand/collapse on macOS ctrl+click context menu

  • Adds isContextMenuPointerDown in Sidebar.logic.ts to detect context menu gestures: secondary button (all platforms) or ctrl+primary-click (macOS only).
  • In Sidebar.tsx, handleProjectTitlePointerDownCapture stops propagation when a context menu gesture is detected, preventing the drag sensor from arming.
  • A suppressProjectClickForContextMenuRef ref 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 isContextMenuPointerDown to detect context-menu pointer gestures, stops pointer event propagation during capture to avoid arming the @dnd-kit drag 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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8b56282a-4ab9-443e-a803-e5787d15853c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 11, 2026
@Noojuno Noojuno changed the title fix: Prevent sidebar project clicks after context-menu pointer gestures fix: Prevent sidebar project dragging when using macos control+click to open context menu Mar 11, 2026
@github-actions github-actions bot added the size:M 30-99 changed lines (additions + deletions). label Mar 12, 2026
@Noojuno Noojuno force-pushed the t3code/debug-sidebar-context-drag-mode branch from 6ab08cf to 09bd3aa Compare March 12, 2026 20:25
@Noojuno Noojuno requested a review from juliusmarminge March 12, 2026 20:27
@Noojuno Noojuno force-pushed the t3code/debug-sidebar-context-drag-mode branch 3 times, most recently from 32f802c to 44f8826 Compare March 12, 2026 20:43
@Noojuno
Copy link
Copy Markdown
Contributor Author

Noojuno commented Mar 12, 2026

@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

@juliusmarminge
Copy link
Copy Markdown
Member

@macroscope-app review this

Noojuno and others added 3 commits March 25, 2026 10:07
- 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
@Noojuno Noojuno force-pushed the t3code/debug-sidebar-context-drag-mode branch from ff700af to ac752db Compare March 24, 2026 21:09
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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
@juliusmarminge juliusmarminge enabled auto-merge (squash) March 28, 2026 23:08
@juliusmarminge juliusmarminge merged commit 64d21bd into pingdotgg:main Mar 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants