microsoft / microsoft/monaco-editor

[Bug] Cut Event from context menu has event type 'copy'

Open
#5,382 1 comment 0 reactions 1 assignee View on GitHub

@hediet is already working on this.

Since Jul 1, 2026.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.55.1#XQAAAAIZAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw0gRaKAEiAKctgAboa7AaZZDHLgrLqPRv_fRv2RyIokydlTdTYccsu6v6jDrc8jQ8ulrCVzjWBVWZVl-YrARXWjIggHVjHNxDUV-rDDnS2do8r2-iSPral2ACZ3_-pgaVKB0jI2iQ0NivdJUMBJvmm2GpM20kN25GevjNBG3s9E4UPuRtL1xZJFSUGDMSyrH9vbOyvwQdgNFTTrkUDM0AQ-WAjJpBwCMA3aEY_sO_TjXWmlmrjgtJq3VXVHcxP7Et52VCpyBkxnyvqHc4aWJvFCymnGXVwD-Lm794c8WcnHEHqaH8ijFzn5alugRhA_VnyyOJlbpHLV48w0CqFI7hfohCDCGfVwCSTkh3p5JqEeI0RxK02LAF_-YKAS8

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `function hello() {
	console.log("Hello")
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
	automaticLayout: true,
});

myEditor.getDomNode().addEventListener('copy', (event) => {
	console.log(event.type)
}, true)

myEditor.getDomNode().addEventListener('cut', (event) => {
	console.log(event.type)
}, true)
Reproduction Steps
  1. Select some part of the code.
  2. Open context menu with right mouse click
  3. Select 'Cut'
Actual (Problematic) Behavior

The cut event which can be listened to using

myEditor.getDomNode().addEventListener('cut', (event) => {
console.log(event.type)
}, true)

has type 'copy'

Expected Behavior

The event type should be 'copy'

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.