microsoft / microsoft/monaco-editor
Suggestion box incorrectly offset with translate animated container
Open
@alexdima is already working on this.
Since Dec 9, 2021.
bug
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
When displaying monaco editor in a container that is slided into screen via translate animation, the suggestion box is offset incorrectly by (width of screen - width of container). Disabling the fixedOverflowWidgets option is not something we can do, as the suggestion box would be cut at editor length.

monaco-editor version: 0.30.0
Browser: Chrome Version 90.0.4430.93
OS: Ubuntu
Playground code that reproduces the issue:
const container = document.createElement("div");
container.className = "container";
const monacoElement = document.createElement("div");
monacoElement.className = "monaco";
container.appendChild(monacoElement);
document.body.appendChild(container);
monaco.editor.create(monacoElement, {
language: 'javascript',
fixedOverflowWidgets: true,
});
.container {
width: 550px; /* increase/decrease to see offset change */
height: 100vh;
display: block;
position: fixed;
right: 0;
bottom: 0;
top: 0;
border: 1px solid black;
transform: translateX(100%);
animation: translateAnimation 1s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.monaco {
width: 100%;
height: 300px;
}
@keyframes translateAnimation {
0% {
transform: translateX(100%);
} 100% {
transform: translateX(0);
}
}
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.
Assessment
This issue has not been assessed yet.