microsoft / microsoft/monaco-editor
Native browser undo/redo commands take incorrect effect to the editor content
Open
Nobody has claimed this yet.
bug
editor-input
help wanted
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
monaco-editor version: 0.22.3
Browser: Firefox 85
OS: Windows 10
Playground code that reproduces the issue:
function x() {
console.log("Hello world!");
}
I've reproduced it by the following steps:
- Start Monaco playground.
- Type some text.
- Click the Undo item in the browser menu bar.
- Nothing happens.
- Click the Redo item in the browser menu bar.
- The entered text will be duplicated.
- Also, doesn't work with
document.execCommand('undo')in Chrome.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Monaco playground and reproduce the behavior using the provided JavaScript snippet, then compare the browser Undo and Redo menu commands with document.execCommand('undo'). Done means browser Undo changes the editor content correctly and Redo does not duplicate typed text, including the reported Chrome case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100