Match header action-icon sizes to the search icon#2
Merged
Conversation
The header search button and theme toggle have pixel-identical button boxes, but the theme-toggle's filled contrast disc (radius 10, ∅20 in a 24 viewBox) rendered about 25% wider and far heavier than the search magnifier's stroked lens (radius 8, ∅16). Even though the boxes lined up, the two icons looked mismatched in size on every generated site. Pad the moon icon's viewBox to "-3 -3 30 30". That scales the drawn glyph to 0.8 (24/30) and keeps it centered, so its disc diameter equals the magnifier lens. The 16x16 element box is untouched, so the button height and vertical baseline stay exactly the same; only the icon's drawn size changes. The icon is emitted by core PageShell into every page's header, so the fix is universal: existing sites pick it up on their next rebuild and newly scaffolded sites are born correct. No CSS, no layout, and no other markup changes; a full-site rebuild diff touches only this viewBox.
The globe is a stroked circle of radius 10 (∅20 in a 24 viewBox), so on multilingual sites it rendered wider than the search magnifier's lens (∅16) and, after the theme toggle was normalised, became the largest circle in the action cluster. Apply the same optical-only fix as the theme toggle: pad the globe icon's viewBox to "-3 -3 30 30", scaling the drawn circle to 0.8 so its diameter matches the magnifier lens. The 16x16 element box is untouched, so the button height and baseline stay exactly the same; only the icon's drawn size changes. Search lens, globe, and moon now read as one circle size. Emitted by core PageShell, so the fix is universal and a full-site rebuild diff touches only this viewBox.
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.
Overview
The header action icons were visually mismatched in size. The theme-toggle (a filled moon) and, on multilingual sites, the language-picker (a globe) rendered noticeably larger and heavier than the search icon (a magnifier), even though their buttons are the same size. This makes the navigation bar's right-hand cluster look uneven on every generated site.
This PR normalizes the three icons so they read as one consistent size, with no other visual change.
Design
The mismatch is optical, not geometric. All three buttons share an identical box, and each icon is a
16×16inline SVG. But the search magnifier is a stroked lens of radius 8 (∅16 within a 24-unitviewBox), while the moon is a filled disc of radius 10 (∅20) and the globe a stroked circle of radius 10 (∅20). At equal boxes the radius-10 glyphs draw ~25% wider, and the filled moon also reads heavier.The fix pads each oversized icon's
viewBoxfrom0 0 24 24to-3 -3 30 30. This scales the drawn glyph to24/30 = 0.8and keeps it centered, so the disc/circle diameter matches the magnifier lens. Thewidth="16" height="16"element box is untouched, so button height and vertical baseline are byte-for-byte identical — only the icon's drawn size changes. The search magnifier is left exactly as-is.This lives in the icon markup that SiteKit's core emits (
OutputFileRenderer+PageShell.swift), so every site picks it up on its next build with no theme or CSS edits.Alternatives considered
transform: scale(0.8)— rejected: it re-enters the per-sitetheme.csscascade, needs atransform-origin, and risks sub-pixel blur.width/height— rejected: that shrinks the element box and would break the button-height/baseline equality that is the whole point.viewBoxpad.base.cssbox rule — rejected: the button boxes were never wrong, so there is nothing to fix at the box level.In scope
Out of scope
Before / after
The header's right-hand action cluster — search (magnifier) · language (globe, multilingual only) · theme-toggle (moon) — captured on the Classic, Sidebar and Minimal layouts plus a real production site, in light and dark mode:
Measured: the moon/globe drawn diameter goes from 13.3px to 10.7px (the magnifier's size); every button's border-box and center-Y stays identical to 0.1px. Annotated before/after boards across all seven surfaces are attached for the reviewer.
How I verified
swift run Site build) for the Classic, Sidebar and Minimal layouts and measured the rendered header with Playwright (getBoundingClientRect+ SVGgetBBox): every button border-box and center-Y is identical before vs. after, to 0.1px; only the drawn glyph diameter changes (13.3px → 10.7px, matching the magnifier).viewBoxstrings —base.cssis byte-identical (md5 unchanged), and every other byte (CSS, asset fingerprints, nav, meta, the search icon's ownviewBox) is unchanged.currentColor).swift buildclean;swift test— 872 tests pass.Notes for reviewers
viewBoxattribute edits in one file; the long comment additions explain the optics for future readers.stroke-width: ~2.5on the globe would restore it exactly if ever desired.