Stop the flex row resizing the badges - #33
Merged
Merged
Conversation
The badge strip is a flex row, and flex defaults to align-items: stretch. Replaced elements get stretched too, so the badges grew vertically while their widths stayed at the intrinsic value — the first three rendered 37.5px tall against a natural 28px. The widest badge could not follow: growing its height would have grown its width past the space left on the line, so it stayed at 28px and sat 7.5px shorter than its neighbours. Measured from a 2x render, decoding the PNG and reading the outline extents rather than eyeballing it: before 69.0x37.5 146.5x37.5 152.5x37.5 180.5x30.0 after 69.0x30.0 146.5x30.0 152.5x30.0 180.5x30.0 (30.0 is the 28px badge plus the 1px debug outline top and bottom.) Image rows no longer stretch their items, and badge images pin height: 28px with width: auto and flex: 0 0 auto — shields.io's own for-the-badge height, so every badge renders 1:1 with no scaling at all. Two tests guard the rules, since the failure was invisible in the markup and only showed up rendered. Tests: 1,100 -> 1,102. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The bug
The badge strip is a flex row, and flex defaults to
align-items: stretch. Replaced elements get stretched too, so the badges grew vertically while their widths stayed at the intrinsic value — distorted. The widest badge couldn't follow: growing its height would have grown its width past the space left on the line, so it stayed at its natural size and sat noticeably shorter than its neighbours.Measured from a 2× render by decoding the PNG and reading the debug-outline extents, rather than eyeballing it:
GLEANPYTHON 3.9+DEPENDENCIES 0RELEASE PASSING(30.0 is the 28px badge plus a 1px debug outline top and bottom. Natural height is 28px, so the first three were stretched by 9.5px.)
Rendering the same five badges outside any flex row produced five identical 28px-tall images, which is what isolated the cause to the row rather than the badge service.
The fix
align-items: center)height: 28px; width: auto; flex: 0 0 auto— shields.io's ownfor-the-badgeheight, so each badge renders 1:1 with no scaling at allTwo tests guard those rules. The failure was invisible in the markup and only appeared once rendered, so a markup-level test would never have caught it; asserting the stylesheet keeps the rules from being quietly dropped.
Ran 1102 tests — OK(1,100 before).🤖 Generated with Claude Code