From 07408807de4ccf074fbeca159c9e162289738563 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Thu, 20 Aug 2026 22:24:30 -0700 Subject: [PATCH 1/2] Add tests for BoldIconProvider preserving Phosphor's size default --- packages/icons/src/index.test.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/icons/src/index.test.tsx b/packages/icons/src/index.test.tsx index d1d1e6ae6..e28a2fd63 100644 --- a/packages/icons/src/index.test.tsx +++ b/packages/icons/src/index.test.tsx @@ -12,4 +12,18 @@ describe("@corbits/icons", () => { test("re-exports the bold icon provider and icon type", () => { expect(typeof icons.BoldIconProvider).toBe("function"); }); + + // Regression for the oversized right-click menu / search bar: Phosphor's + // IconContext.Provider fully replaces the context value rather than + // merging with it, so a bare `{ weight: "bold" }` silently drops the + // library's own `size: "1em"` default. Any glyph mounted without an + // ancestor CSS rule or an explicit `size=` prop then renders as a bare + // with no width/height, which the browser falls back to sizing as + // a 300x150 replaced element. + test("BoldIconProvider preserves Phosphor's size default alongside bold weight", () => { + expect(icons.boldIconContextValue).toEqual({ + size: "1em", + weight: "bold", + }); + }); }); From e3dbb86d6169a3a24fc989135175a45856234f38 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Thu, 20 Aug 2026 22:24:31 -0700 Subject: [PATCH 2/2] Fix BoldIconProvider dropping Phosphor's size:1em default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 is 300x150, which is why the right-click context menu and the search bar rendered wildly oversized. --- packages/icons/src/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/icons/src/index.tsx b/packages/icons/src/index.tsx index 15791e475..0bb1d0693 100644 --- a/packages/icons/src/index.tsx +++ b/packages/icons/src/index.tsx @@ -84,12 +84,20 @@ export { X, } from "@phosphor-icons/react"; +/** `IconContext.Provider` replaces Phosphor's whole context value rather than + * merging with it, so this must restate every default the library ships + * (`size: "1em"`) alongside the one we're overriding (`weight: "bold"`) — + * dropping `size` silently un-sizes every glyph that has no ancestor CSS + * rule and no explicit `size=` prop, which is why the right-click menu and + * the search bar rendered at the browsers' unsized- fallback. */ +export const boldIconContextValue = { size: "1em", weight: "bold" } as const; + /** Wraps a subtree so every Phosphor icon under it defaults to bold weight * without repeating `weight="bold"` at each call site. Mounted once at each * app's root (see `apps/web/src/app.tsx`). */ export function BoldIconProvider({ children }: { children: ReactNode }) { return ( - + {children} );