Skip to content

Fix workbench hover content being clipped without a scrollbar - #330804

Open
Zhang Zhijie (hi-jie) wants to merge 1 commit into
microsoft:mainfrom
hi-jie:fix/hover-max-height-scroll
Open

Fix workbench hover content being clipped without a scrollbar#330804
Zhang Zhijie (hi-jie) wants to merge 1 commit into
microsoft:mainfrom
hi-jie:fix/hover-max-height-scroll

Conversation

@hi-jie

Copy link
Copy Markdown

Fixes #215972

Problem

The workbench hover widget only constrained the max-height of the outer hover container (.monaco-hover). Content taller than the limit was clipped by the container's overflow: hidden, and the built-in scrollbar never activated because the inner content element (.monaco-hover-content) was never height constrained — the DomScrollableElement only shows a scrollbar when scrollHeight > clientHeight of the element it wraps.

This is visible e.g. when hovering a long commit message in the SCM History / Timeline views: the tooltip gets truncated and cannot be scrolled (also reported in #204865, which was closed as not_planned).

Fix

Apply the maximum height to all three layers of the hover widget instead of only the container, mirroring how the editor hover widget already constrains its dimensions via _setHoverWidgetMaxDimensions:

  • src/vs/base/browser/ui/hover/hoverWidget.ts: add a maxHeight setter on the base hover widget that constrains the container, the scrollable element and the content element.
  • src/vs/platform/hover/browser/hoverWidget.ts: use the new setter in adjustHoverMaxHeight.
  • src/vs/platform/hover/test/browser/hoverService.test.ts: regression test asserting the content and scrollable elements receive the same max height as the container.

Validation

  • npm run typecheck-client passes
  • node test/unit/browser/index.js --browser chromium --run out/vs/platform/hover/test/browser/hoverService.test.js: 33 passing (including the new regression test)
  • ESLint passes on all changed files

The workbench hover widget only constrained the maximum height of the
outer hover container. Content taller than the limit was clipped by the
container's `overflow: hidden`, and the built-in scrollbar never
activated because the inner content element was never height
constrained. Apply the maximum height to the scrollable element and the
content element as well, mirroring how the editor hover widget
constrains its dimensions. This makes long content, such as long commit
messages in the SCM history and timeline views, scrollable instead of
truncated.

Fixes microsoft#215972
Copilot AI balanced review requested due to automatic review settings August 14, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hi-jie

Copy link
Copy Markdown
Author

@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