Skip to content

fix(agents): prevent native context menu on conversation images - #6995

Merged
l0ng-ai merged 2 commits into
mainfrom
fix/image-context-menu
Nov 30, 2026
Merged

l0ng-ai merged 2 commits into
mainfrom
fix/image-context-menu

Conversation

@l0ng-ai

@l0ng-ai l0ng-ai commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Problem

Right-clicking a conversation image thumbnail (ImageStrip) or its full-size preview (ImagePreview) shows the WebView's native image context menu (Open Image in New Window, Download Image, Copy Image, etc.).

Both handlers called event.stopPropagation() without calling event.preventDefault(). Stopping propagation at the React root prevents the contextmenu event from bubbling to window, bypassing the global preventDefault() in installBrowserGuards().

Fix

  • Call event.preventDefault() in the onContextMenu handlers of ImageStrip and ImagePreview.
  • Assert defaultPrevented (via fireEvent.contextMenu(...) === false) in ImageStrip.test.tsx for both the thumbnail and full preview.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

Thanks for the PR. Before review, please update the description (see CONTRIBUTING.md):

  • Fill in How it was verified: the commands you ran and their results. UI changes need before/after screenshots.

This check reruns when you edit the description.

@arookieofc-ai arookieofc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — preventDefault() before stopPropagation() is the right order here: the native menu is suppressed and the custom one still opens. Test covers both the preview and the strip.

@l0ng-ai
l0ng-ai merged commit 092cde1 into main Nov 30, 2026
2 checks passed
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.

2 participants