🐛 fix: アイコンの font-weight を 500 に固定し親要素からの継承を防ぐ#281
Conversation
- Icon の span に font-medium を付与し、親(Button の bold ラベル等)から font-weight: 700 が継承されて疑似ボールドで太く描画される問題を修正 - Material Symbols Rounded は wght 500 のみ読み込んでいるため、継承された 700 はフォント合成(faux bold)として描画されていた - className からの font-weight 上書きは tailwind-merge により引き続き可能 - Icon のフォントウェイトに関するテストを追加 Fixes goodpatch/sparkle-design-internal#198 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughIcon コンポーネントの ChangesIcon フォントウェイト固定化
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a visual bug where icons could render with faux-bold when placed inside bold text contexts (e.g., Button), by explicitly setting the icon’s font-weight to 500 at the component level and adding regression tests.
Changes:
- Add
font-mediumto theIconroot<span>to prevent inherited boldfont-weightfrom triggering faux-bold rendering. - Add unit tests to ensure
font-mediumis applied by default and remains overridable viaclassName(viatailwind-merge).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/components/ui/icon/index.tsx |
Explicitly applies font-medium to prevent inherited bold weight from affecting icon rendering. |
src/components/ui/icon/index.test.tsx |
Adds tests covering default font weight application and override behavior via className. |
概要
goodpatch/sparkle-design-internal#198 の修正です。
Button の
character-*-bold-pro(font-weight: 700)がボタン全体にかかり、icon の span にも継承されることで、アイコンが太く(もっさり)描画されるバグを修正します。原因
wght500 のみ読み込んでいる(SparkleHead.tsx).icon-*-fill-*クラスはfont-variation-settings: 'wght' 500を指定しているが、font-weight自体は未指定のため親から 700 を継承するfont-weight: 700に対して 500 のフォントフェイスしかないため、ブラウザが**疑似ボールド(faux bold)**で描画していたfont-variation-settingsは疑似ボールドを抑止できない(合成は font-weight プロパティとフェイス宣言の差分で発動するため)修正内容
Iconの span にfont-medium(font-weight: 500)を明示付与classNameからの font-weight 上書きは tailwind-merge により引き続き可能確認
pnpm test: 611 passed(新規 2 件含む)tsc --noEmit: passFixes goodpatch/sparkle-design-internal#198
🤖 Generated with Claude Code