Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Oct 3, 2025

COMPASS-9919

Adds a context menu for cut/copy/paste when right clicking in a scenario that allows the action. This does not work in modals.

cut.copy.paste.mp4

@Anemy Anemy requested a review from a team as a code owner October 3, 2025 08:11
@Anemy Anemy requested review from Copilot and gribnoysup October 3, 2025 08:11
@github-actions github-actions bot added the feat label Oct 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds right-click context menu functionality for cut/copy/paste operations in text elements. The implementation provides contextual menu items based on text selection state and element editability, using the modern Clipboard API with fallback to deprecated execCommand.

  • Implements a new hook useCopyPasteContextMenu that detects text selection and element editability
  • Adds keyboard interaction preservation when context menu items are clicked
  • Integrates copy/paste context menu into the main component provider system

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/compass-context-menu/src/context-menu-provider.tsx Extracts inline styles to a constant for consistency
packages/compass-components/src/hooks/use-copy-paste-context-menu.tsx New hook implementing copy/paste context menu logic with clipboard operations
packages/compass-components/src/hooks/use-copy-paste-context-menu.spec.tsx Comprehensive test suite for the copy/paste context menu functionality
packages/compass-components/src/components/context-menu.tsx Adds mouse event handling to preserve focus when menu items are clicked
packages/compass-components/src/components/content-with-fallback.spec.tsx Updates test expectations to account for new copy/paste context menu container
packages/compass-components/src/components/compass-components-provider.tsx Integrates CopyPasteContextMenu component into the provider hierarchy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant