Fix workbench hover content being clipped without a scrollbar - #330804
Open
Zhang Zhijie (hi-jie) wants to merge 1 commit into
Open
Fix workbench hover content being clipped without a scrollbar#330804Zhang Zhijie (hi-jie) wants to merge 1 commit into
Zhang Zhijie (hi-jie) wants to merge 1 commit into
Conversation
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
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #215972
Problem
The workbench hover widget only constrained the
max-heightof the outer hover container (.monaco-hover). Content taller than the limit was clipped by the container'soverflow: hidden, and the built-in scrollbar never activated because the inner content element (.monaco-hover-content) was never height constrained — theDomScrollableElementonly shows a scrollbar whenscrollHeight > clientHeightof 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 amaxHeightsetter 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 inadjustHoverMaxHeight.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-clientpassesnode test/unit/browser/index.js --browser chromium --run out/vs/platform/hover/test/browser/hoverService.test.js: 33 passing (including the new regression test)