Fix Improve vertical alignment of text and icons in status bar #162995#282192
Fix Improve vertical alignment of text and icons in status bar #162995#282192chaitanyamedidar wants to merge 3 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a subtle visual alignment issue in the status bar where text appears slightly below the optical center due to asymmetric font metrics across platforms. The fix applies a 1-pixel vertical translation to improve the optical alignment of text while keeping icons centered.
Key Changes:
- Applied
transform: translateY(-1px)to status bar item labels to shift text upward - Counter-adjusted codicons with
transform: translateY(1px)to maintain their centered position - Added explicit
line-height: 1to codicons for consistent 1:1 aspect ratio
src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
This looks risky and fragile, but I want to give @mrleemurray a chance to chime in on this. |
Technical Breakdown: Status Bar Vertical Alignment FixThe Status Bar is using To resolve this, I implemented a solution using My Solution:
|
Fix vertical alignment of text and icons in status bar
Description
This PR fixes the vertical alignment of text and icons in the status bar by applying a subtle optical adjustment to compensate for asymmetric font metrics across different platforms.
Fixes #162995
Changes
Modified
src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css:transform: translateY(-1px)to.statusbar-item-labelto shift text up by 1px for better optical centeringtransform: translateY(1px)to.statusbar-item-label > span.codiconto counter-adjust icons, keeping them in their original centered positionline-height: 1to.statusbar-item span.codiconfor consistent icon sizingProblem
Text and icons in the status bar were not perfectly aligned vertically. The text appeared slightly below the optical center of the 22px status bar due to asymmetric vertical spacing in system fonts (e.g., Segoe UI on Windows, San Francisco on macOS). This misalignment was subtle (approximately 1-2px) but noticeable, particularly at default zoom levels as reported by @bpasero.
Solution
Applied a global 1px transform adjustment:
The fix is applied globally across all platforms (Windows, macOS, Linux) rather than platform-specific, as the issue was reported on multiple platforms.
Testing
Tested
Before:


After:
Windows 11 with Segoe UI font - verified improved alignment using DevTools
Needs Verification
How to Test
Note: The difference is subtle (1px) and may require zooming in or adding visual guides to see clearly. The improvement is most noticeable on systems where font metrics cause the most asymmetry.
Implementation Notes
transforminstead of padding/margin to avoid affecting layout calculations@bpasero Please review the draft, Thank you.