[Bug] Tooltips wrap and cover their button near the right edge of a positioned editor container

Open
#5,516 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hediet is already working on this.

Since Oct 7, 2026.

Assessment

This issue has not been assessed yet.

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.57.0#XQAAAALwAQAAAAAAAABBqIlHNxBQ4pnuQgl9ETAKlRb1bNQegVWPIh_HKkSVYy3wrjnb_JSXFfQzd33EHL2Ri3c6Nv-gxgD9e4Jg_hUD66DB2qEz4_0hcvu_Y8C79pEzF7NtFwAbijh4ycz8fbcHRzRWCopReABHyBhEI1WI_Jj93t_nDCflOqRmS42KSsS3_hV8uBGvXcbCaXPo2mKwep1IRMdvXv5M9tb9w44TzKbkUYIWN5kL3Y0-ywk_oJyCsllz7avpGqjYoaBMjSx4XhclU-s8kNbWkp7Kne3Bz_jygl9V0wf_WXtJwg0d0lYFv5qSne_c5_iSNHFaQIkzpkVptehbRs8tDyHgxmjcolB3sApAt6fC88opOyRZ23syhD5U59jj6Mw8kV9DlvDpGTV9jfvzcoTds8zelZ8opqvaxt83hQveVs1RLIGF4ueGgfPG8k8fn5XGHbnLQXQoX0lXhSnYpwPQ5hbL1dtpgkpSn6FYXLdRDxLaRo_sE9T8DOlHxWzWixegjWn_CKL8AA

Monaco Editor Playground Code

HTML:

<div id="container" style="position: relative; width: 400px; height: 300px; margin-top: 100px; border: 1px solid #888"></div>

JS:

// The editor is narrower than the window, as when it's embedded in a page.
const editor = monaco.editor.create(document.getElementById("container"), {
	value: "const text = 'hello';\n",
	language: "javascript",
	minimap: { enabled: false },
});

// Open find, then hover its Close button.
editor.focus();
editor.trigger("repro", "actions.find", {});
Reproduction Steps
  1. Run the preview. The find widget opens.
  2. Hover its Close button, at the editor's right edge.
Actual (Problematic) Behavior

"Close (Escape)" wraps onto two lines and covers the button:

Positioned container: Close (Escape) wraps onto two lines and covers the Close button
Expected Behavior

The tooltip stays on one line above the button, as it does when the container isn't positioned (position: static):

Static container: Close (Escape) on one line above the Close button
Additional Context

ContextView.doLayout measures the tooltip at left: 0, where it fits on one line, places it using that height, then sets width: initial. Near the right edge of a positioned container, the absolutely positioned tooltip then shrinks to the space left, wraps, and grows over the button. Keeping the measured width fixes it.

.context-view { min-width: max-content; } works around it, though a tooltip wider than the window then runs past its edge.

#5112 (fixed in 0.57.0) and #5515 are about these tooltips' vertical position; this one is about their width.

Dominant language
JavaScript
Stars
47k
Forks
4.2k
Avg merge
3d 13h
Merged PRs (30d)
13

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.