Skip to content

Commit 33d8130

Browse files
committed
fix: enable scrolling in workbench hover widget when content overflows
1 parent 6743fb4 commit 33d8130

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/vs/platform/hover/browser/hoverWidget.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class HoverWidget extends Widget implements IHoverWidget {
5959
private _enableFocusTraps: boolean = false;
6060
private _addedFocusTrap: boolean = false;
6161
private _maxHeightRatioRelativeToWindow: number = 0.5;
62+
private _statusBarElement: HTMLElement | undefined;
6263

6364
private get _targetWindow(): Window {
6465
return dom.getWindow(this._target.targetElements[0]);
@@ -222,6 +223,7 @@ export class HoverWidget extends Widget implements IHoverWidget {
222223
});
223224
statusBarElement.appendChild(actionsElement);
224225
this._hover.containerDomNode.appendChild(statusBarElement);
226+
this._statusBarElement = statusBarElement;
225227
}
226228

227229
this._hoverContainer = $('div.workbench-hover-container');
@@ -342,6 +344,7 @@ export class HoverWidget extends Widget implements IHoverWidget {
342344
public layout() {
343345
this._hover.containerDomNode.classList.remove('right-aligned');
344346
this._hover.contentsDomNode.style.maxHeight = '';
347+
this._hover.scrollbar.getDomNode().style.maxHeight = '';
345348

346349
const getZoomAccountedBoundingClientRect = (e: HTMLElement) => {
347350
const zoom = dom.getDomNodeZoomLevel(e);
@@ -585,6 +588,8 @@ export class HoverWidget extends Widget implements IHoverWidget {
585588
}
586589

587590
this._hover.containerDomNode.style.maxHeight = `${maxHeight}px`;
591+
const statusBarHeight = this._statusBarElement?.offsetHeight ?? 0;
592+
this._hover.scrollbar.getDomNode().style.maxHeight = `${maxHeight - statusBarHeight}px`;
588593
if (this._hover.contentsDomNode.clientHeight < this._hover.contentsDomNode.scrollHeight) {
589594
// Add padding for a vertical scrollbar
590595
const extraRightPadding = `${this._hover.scrollbar.options.verticalScrollbarSize}px`;

0 commit comments

Comments
 (0)