fix: prevent initial right-click from selecting a context menu item#3877
fix: prevent initial right-click from selecting a context menu item#3877Fazalkadivar21 wants to merge 1 commit into
Conversation
- Prevent the initial pointer click from selecting a menu item - Add coverage for delayed pointer selection
|
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 |
ApprovabilityVerdict: Approved Simple bug fix that adds a guard condition to prevent accidental menu item selection from the initial right-click gesture. Uses an existing You can customize Macroscope's approvability policy. Learn more. |
What Changed
Why
On Linux, right-clicking a project or thread in the desktop app could cause the context menu to briefly appear and immediately close while activating a menu item.
The same pointer interaction used to open the menu was also being interpreted as a menu-item selection. This made context menus unreliable and could trigger unintended actions without a second click.
This change keeps pointer selection disabled during the initial opening interaction, while still allowing menu items to be selected normally after the required delay.
Fixes #3698
UI Changes
Before
Right-clicking a project or thread could immediately activate a random context-menu item and close the menu.
Recording:
before.mp4
After
The context menu remains open after the initial right-click and waits for a separate selection from the user.
Recording:
recording_2026-07-11_08.01.50.mp4
Checklist
Note
Low Risk
Small, localized change to fallback context-menu pointer handling with targeted test coverage; no auth, data, or API impact.
Overview
Fixes Linux/desktop behavior where the same pointer interaction that opened the fallback context menu could immediately activate a leaf item and close the menu.
Leaf menu buttons now call
cleanuponly whencanDismissFromPointeris true, matching the existing delay (set on the next animation frame) used for outside dismiss. Clicks during the opening gesture are ignored; a separate click still selects normally.Adds a test that defers the rAF callback so the first click is ignored and the second resolves the item id.
Reviewed by Cursor Bugbot for commit d5fe9e0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Ignore the opening click gesture in the context menu fallback
A click that occurs before the first animation frame after the menu opens no longer resolves the menu. This is done by gating leaf-item click handling on a
canDismissFromPointerflag, which is set totrueviarequestAnimationFrameafter the menu is rendered.Macroscope summarized d5fe9e0.