microsoft / microsoft/monaco-editor

Suggestion box incorrectly offset with translate animated container

Open
#2,793 15 comments 17 reactions 1 assignee View on GitHub

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

Screenshot from 2021-11-25 14-24-45

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

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.