Skip to content

Commit c38ae80

Browse files
committed
Improve robustness of tooltips with refined HoverBox positioning in 3.4.7
1 parent 0ab234e commit c38ae80

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/jupyterlab-lsp/src/components/free_tooltip.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,18 @@ export class FreeTooltip extends Tooltip {
138138
const style = window.getComputedStyle(this.node);
139139
const paddingLeft = parseInt(style.paddingLeft!, 10) || 0;
140140

141+
// When the editor is attached to the main area, contain the hover box
142+
// to the full area available (rather than to the editor itself); the available
143+
// area excludes the toolbar, hence the first Widget child between MainAreaWidget
144+
// and editor is preferred.
145+
const host =
146+
(editor.host.closest('.jp-MainAreaWidget > .lm-Widget') as HTMLElement) ||
147+
editor.host;
148+
141149
// Calculate the geometry of the tooltip.
142150
HoverBox.setGeometry({
143151
anchor,
144-
host: editor.host,
152+
host: host,
145153
maxHeight: MAX_HEIGHT,
146154
minHeight: MIN_HEIGHT,
147155
node: this.node,

0 commit comments

Comments
 (0)