Skip to content

Conversation

@mrleemurray
Copy link
Contributor

@mrleemurray mrleemurray commented Nov 11, 2025

Improve the layout and spacing of the hover widget by refining styles and removing unused CSS rules. Adjustments enhance the overall appearance & align codicon sizes with the rest of the UI.

image

Copilot AI review requested due to automatic review settings November 11, 2025 12:01
@mrleemurray mrleemurray self-assigned this Nov 11, 2025
@mrleemurray mrleemurray added ux User experience issues papercut 🩸 A particularly annoying issue impacting someone on the team labels Nov 11, 2025
@mrleemurray mrleemurray added this to the November 2025 milestone Nov 11, 2025
Copy link
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

This PR refactors hover widget styles to improve layout consistency and visual alignment. The changes consolidate hover styling by moving specific SCM history item hover styles into general hover widget styles and adjusting spacing and sizing throughout.

Key Changes

  • Removes line-height: 19px from workbench hover for more flexible line height handling
  • Consolidates codicon sizing to 16px across hover content paragraphs
  • Adjusts margin values for <hr>, <h1-h6>, and paragraph elements to reduce spacing
  • Removes redundant SCM-specific history item hover styles that are now covered by base hover styles

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/vs/workbench/contrib/scm/browser/media/scm.css Removes redundant history-item-hover paragraph and span styling that duplicates base hover styles
src/vs/platform/hover/browser/hover.css Adds codicon sizing rules and flexbox layout for hover content paragraphs
src/vs/base/browser/ui/hover/hoverWidget.css Adjusts margins for headings, hr elements, and paragraphs; adds flexbox layout and image styles

font-size: 12px;
}

.monaco-hover.workbench-hover.compact .codicon,
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The CSS selector combines two unrelated rules. The .monaco-hover.workbench-hover.compact .codicon selector targets codicons in compact hovers, while .monaco-hover.monaco-hover-content .code-hover-contents targets code hover contents. These should be separate rules for clarity and maintainability. Split this into two rules to avoid confusion about which properties apply to which elements.

Suggested change
.monaco-hover.workbench-hover.compact .codicon,
.monaco-hover.workbench-hover.compact .codicon {
font-size: 16px;
}

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +43
/* Increase codicon size in hover content paragraphs - use !important to override inline styles */
.monaco-hover .monaco-hover-content p .codicon {
font-size: 16px !important;
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Using !important to override inline styles is a code smell that suggests the underlying issue should be fixed at the source. The comment states this is to override inline styles, but it would be better to avoid setting inline styles for codicon font-size in the first place. Consider addressing the root cause instead of using !important.

Suggested change
/* Increase codicon size in hover content paragraphs - use !important to override inline styles */
.monaco-hover .monaco-hover-content p .codicon {
font-size: 16px !important;
/* Increase codicon size in hover content paragraphs */
.monaco-hover .monaco-hover-content p .codicon {
font-size: 16px;

Copilot uses AI. Check for mistakes.
margin-top: 4px;
margin-bottom: -4px;
margin-top: 0px;
margin-bottom: 0px;
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Unnecessary use of units with zero values. Per CSS best practices, 0px should be written as 0 (no unit needed). This applies to both margin-top and margin-bottom.

Suggested change
margin-bottom: 0px;
margin-bottom: 0;

Copilot uses AI. Check for mistakes.
*/
.monaco-hover .markdown-hover .hover-contents:not(.code-hover-contents):not(.html-hover-contents) span.codicon {
margin-bottom: 2px;
/* margin-bottom: 2px; */
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Commented-out code should be removed rather than left in the codebase. If this margin-bottom is no longer needed, delete this line entirely. If there's uncertainty about removing it, document the reasoning in a proper code comment.

Suggested change
/* margin-bottom: 2px; */

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +87
.monaco-hover p:first-child {
margin-top: 4px;
display: flex;
align-items: center;
}
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The p:first-child selector now has display: flex which could affect all first paragraph elements in hovers, even those without images. The subsequent rule at line 89 specifically targets images inside first paragraphs. Consider whether the flexbox layout should only apply when an image is present, or add a comment explaining this is intentional for all first paragraphs.

Copilot uses AI. Check for mistakes.
font-size: 16px !important;
}

.monaco-hover .monaco-hover-content p:last-child {
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Setting display: flex on all last paragraph elements without specific justification could cause layout issues. This appears to be specifically needed for the anchor element styling on lines 50-53, but will affect all last paragraphs regardless of whether they contain links. Consider a more specific selector like p:last-child:has(a) or document why all last paragraphs need flex display.

Suggested change
.monaco-hover .monaco-hover-content p:last-child {
.monaco-hover .monaco-hover-content p:last-child:has(a) {

Copilot uses AI. Check for mistakes.
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

The list item spacing looked a lot better before imo with less padding.

Also a good idea to test many of the hovers, especially more detailed ones:

  • Editor tabs
  • Extension view
  • Terminal tabs
  • GHPR Issues and PRs
  • Manage language model editor list item hovers (just fixed a margin issue here)

@Tyriar
Copy link
Member

Tyriar commented Nov 11, 2025

cc @benibenj

@abhijit-chikane
Copy link
Contributor

abhijit-chikane commented Nov 11, 2025

Looks like
image
vertical bar are not vertically align in the center within new change
Also I feel tgere shouldn’t be a comma after name and should have gap between history icon

Otherwise new looks 👌

@lszomoru
Copy link
Member

Thanks @mrleemurray.

  • +1 on the no comma after the name, maybe a bit more spacing
  • The vertical bar is aligned with the text and not the codicons. Maybe we could try a unicode character that is a higher bar?
  • The text and the codicons and not vertically centered (something that has been bothering me for some time)

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

Labels

papercut 🩸 A particularly annoying issue impacting someone on the team ux User experience issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants