Skip to content

fix: enable scrolling in workbench hover widget when content overflows#312646

Open
galpodlipnik1 wants to merge 2 commits intomicrosoft:mainfrom
galpodlipnik1:fix/hover-tooltip-scroll
Open

fix: enable scrolling in workbench hover widget when content overflows#312646
galpodlipnik1 wants to merge 2 commits intomicrosoft:mainfrom
galpodlipnik1:fix/hover-tooltip-scroll

Conversation

@galpodlipnik1
Copy link
Copy Markdown

Fixes #215972

Problem

The hover widget sets maxHeight on containerDomNode (which has overflow: hidden in CSS), but never constrains the DomScrollableElement wrapper inside it. Without a height constraint on the scrollable element, scrollHeight always equals clientHeight - the scrollbar never activates. The outer container's overflow: hidden simply clips the content invisibly.

Fix

  • Store a reference to the status bar element (_statusBarElement) when actions are rendered in the constructor
  • In adjustHoverMaxHeight, set maxHeight on scrollbar.getDomNode() equal to maxHeight - statusBarHeight, so DomScrollableElement detects the overflow and activates the scrollbar
  • Reset scrollbar.getDomNode().style.maxHeight at the start of each layout() call

Testing

Hover over a terminal tab that has multiple extensions contributing to its environment (e.g. GitLens, GitHub Copilot) - enough to overflow the tooltip. The tooltip should now be scrollable with the mouse wheel instead of clipping the content.

Copilot AI review requested due to automatic review settings April 27, 2026 00:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a workbench hover regression where long hover content is clipped instead of being scrollable by attempting to correctly constrain the hover’s scrollable region when a max height is applied.

Changes:

  • Store a reference to a rendered status bar row for height calculations.
  • Reset the scrollable element’s maxHeight at the start of each layout() call.
  • Subtract the status bar height from the hover’s computed max height and apply it to the scrollable region.

Comment thread src/vs/platform/hover/browser/hoverWidget.ts Outdated
Comment thread src/vs/platform/hover/browser/hoverWidget.ts Outdated
Comment thread src/vs/platform/hover/browser/hoverWidget.ts Outdated
Comment thread src/vs/platform/hover/browser/hoverWidget.ts Outdated
Add test to verify that `adjustHoverMaxHeight()` constrains the
`contentsDomNode` height so `DomScrollableElement.scanDomNode()` can
detect overflow and activate scrolling.

Also add `lookupKeybinding` stub to the `IKeybindingService` mock so
hovers with actions render without errors.
@galpodlipnik1
Copy link
Copy Markdown
Author

@galpodlipnik1 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to scroll text in hover dialogs

3 participants