Skip to content

CL-6470: Fix BoldIconProvider dropping the size:1em default - #191

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6470-tokens
Aug 21, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-6470-tokens

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • BoldIconProvider (packages/icons/src/index.tsx) was passing IconContext.Provider value={{ weight: "bold" }} — since IconContext.Provider replaces the whole context value rather than merging with it, this silently dropped Phosphor's own size: "1em" default for every icon mounted under it.
  • Root cause (found on the sibling CL-6464 lane, handed to this lane): any glyph with no ancestor CSS rule (e.g. react-ui's Button has a [&_svg]:size-4 rule; react-ui's MenuItem does not) and no explicit size= prop rendered as a bare <svg> with no width/height — the browser's fallback for an unsized replaced element is 300x150. That is exactly why the right-click context menu and the search bar rendered wildly oversized.
  • Fix: boldIconContextValue now restates size: "1em" alongside weight: "bold", and is exported so the fix is directly testable.

Context

Part of CL-6470 (design tokens from the mock). The named icon-size scale itself (nav/top-bar/button/checkbox) is a separate PR against corbitsdev/react-ui: corbitsdev/react-ui#36 — that PR is the token source of truth; this one is the upstream bug that made every unsized icon balloon in the first place.

Sweeping the ~14 remaining hand-declared size= call sites onto the new react-ui tokens is a follow-up unit, not done here (scope kept to the root-cause fix + the token PR, per current timebox policy).

Test plan

  • bun test packages/icons/src/index.test.tsx — new regression test, red before the fix, green after
  • bun run build in apps/web — not run in this pass; not covered by this scoped check

Not merged — pushed for peer review per current policy.

IconContext.Provider replaces the whole context value rather than
merging with it, so {weight:"bold"} alone silently un-sized every
glyph with no ancestor CSS rule and no explicit size= prop — the
browser's fallback for an unsized replaced-element <svg> is 300x150,
which is why the right-click context menu and the search bar rendered
wildly oversized.
@TheGreatAxios
TheGreatAxios merged commit 8fca166 into main Aug 21, 2026
0 of 2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-6470-tokens branch August 25, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant