Skip to content

fix misleading cut-copy-paste context menu in table and tree view - #134

Merged
Tomasz Naumowicz (tnaum-ms) merged 5 commits into
mainfrom
dev/tnaum/81-misleading-cutcopypaste-context-menu-in-tabletree-view
Jun 6, 2025
Merged

Tomasz Naumowicz (tnaum-ms) merged 5 commits into
mainfrom
dev/tnaum/81-misleading-cutcopypaste-context-menu-in-tabletree-view

Conversation

@tnaum-ms

Copy link
Copy Markdown
Collaborator

This pull request introduces a new custom hook, useSelectiveContextMenuPrevention, to improve user experience by selectively disabling context menus in non-editor elements while preserving functionality in Monaco editor components. The hook is integrated into two views (CollectionView and DocumentView) to enhance their behavior.

New feature: Custom hook for context menu prevention

Integration of the custom hook

Copilot AI review requested due to automatic review settings June 5, 2025 18:57

This comment was marked as outdated.

Copilot 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.

Pull Request Overview

This PR adds a custom hook to suppress unwanted context menus outside of Monaco editors and integrates it into the DocumentView and CollectionView components.

  • Introduced useSelectiveContextMenuPrevention hook to block context menus on non-editor elements.
  • Applied the hook in both DocumentView and CollectionView for consistent behavior.

Reviewed Changes

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

File Description
src/webviews/api/webview-client/utils/useSelectiveContextMenuPrevention.ts New hook that adds/removes a global contextmenu listener with an allowlist of editor selectors.
src/webviews/documentdb/documentView/documentView.tsx Imported and invoked the hook in the DocumentView component.
src/webviews/documentdb/collectionView/CollectionView.tsx Imported and invoked the hook in the CollectionView component.
Comments suppressed due to low confidence (1)

src/webviews/api/webview-client/utils/useSelectiveContextMenuPrevention.ts:1

  • There are no tests covering the new useSelectiveContextMenuPrevention hook. Adding unit or integration tests to confirm context menus are blocked/allowed as expected would ensure stability.
/*---------------------------------------------------------------------------------------------

@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/81-misleading-cutcopypaste-context-menu-in-tabletree-view branch June 6, 2025 05:51
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.

Misleading Cut/Copy/Paste Context Menu in Table/Tree View

2 participants