Skip to content

fix(styles): replace undefined --font-weight-* vars with SDS tokens - #2946

Draft
CassioMG wants to merge 1 commit into
masterfrom
fix/undefined-font-weight-vars
Draft

fix(styles): replace undefined --font-weight-* vars with SDS tokens#2946
CassioMG wants to merge 1 commit into
masterfrom
fix/undefined-font-weight-vars

Conversation

@CassioMG

@CassioMG CassioMG commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What

The SCSS in extension/src referenced var(--font-weight-light|regular|medium|semi-bold|bold) in 59 places. None of those custom properties are defined anywhere — not in extension/src, not in @stellar/design-system. Every one of those declarations has been silently doing nothing.

This swaps all of them for the real SDS tokens, plus one mistyped var(--sds-font-weight-medium) that was broken the same way. 60 replacements, 35 files, no other changes.

Why they're undefined

Tailwind v4 is loaded globally (popup/styles/vendor/tailwind.csspopup/index.tsx), and its theme.css does define --font-weight-medium: 500. But v4 prunes unused theme variables. Extracting the emitted :root, :host block from a fresh extension/build/index.min.js, the only font-weight variable that reaches the cascade is:

--font-weight-semibold: 600

…which is a different spelling from the --font-weight-semi-bold this repo uses.

The full Tailwind list does appear in the bundle, but only inside an @theme default { … } at-rule — a compile-time construct browsers discard as unknown. A naive grep of the build makes it look live, so this is worth knowing if you go verifying.

Since font-weight is inherited, each declaration was invalid at computed-value time → unset → inherited the parent's weight (usually 400).

Mapping

Replaced With Value Sites
--font-weight-light --sds-fw-light 300 5
--font-weight-regular --sds-fw-regular 400 7
--font-weight-medium --sds-fw-medium 500 44
--font-weight-semi-bold --sds-fw-semi-bold 600 2
--font-weight-bold --sds-fw-bold 700 1
--sds-font-weight-medium (typo) --sds-fw-medium 500 1

⚠️ This is a visual change, not a refactor

Text at the medium / semi-bold / bold sites gets heavier — that's the fix landing, but it touches many screens and reviewers should expect a visible diff.

Two things worth a human eyeball:

  1. The five light sites go the other direction — 400 → 300, i.e. thinner. All are large display numerals, so it's plausibly intended, but it's the least-expected part of this change:

    • components/send/styles.scss__amount-label (2.5rem)
    • components/swap/SwapAmount/styles.scss__amount-label, __amount-label-usd, __input-amount (2.5rem)
    • components/accountHistory/TransactionDetail/styles.scss__header (2rem)
  2. The 7 regular sites are true no-ops. Each was checked for an ancestor setting a heavier weight; none nest under one, so all were already inheriting 400 and now get an explicit 400.

swap/SwapAsset/SwapPickerSections/styles.scss deserves a note: it carries a comment saying SDS renders the Notification title semi-bold and this rule wants it regular. SDS does set that. But the broken override still won the cascade and became unset → 400, so the comment's intent was already being met by accident. No visual change there either.

Deliberately left alone

components/manageAssetsLists/DeleteModal/styles.scss:26 is the one remaining --font-weight- reference, and it's genuinely corrupt:

color: --font-weight-medium --font-weight-medium;

Not a var() usage, so this sweep correctly skipped it. git log -L shows it was color: var(--color-gray-70); until 3aec8c8c ("Release/5.20.0"), where a bad find-and-replace clobbered the value of a color property with two bare font-weight idents. It's invalid CSS, dropped at parse time, so .DeleteModal__body currently inherits its color. Left as-is because picking the right modern SDS gray is a design decision, not a mechanical one.

Related rot, out of scope for this PR: --color-white, --color-red-70, and --color-gray-70 are likewise undefined and still referenced in several files (ModalInfo, NetworkForm, accountMigration/basics). Same silent-failure class — worth a follow-up.

Testing

yarn test:ci
  Test Suites: 6 skipped, 197 passed, 197 of 203 total
  Tests:       51 skipped, 1525 passed, 1576 total

yarn build:extension
  webpack compiled in 23116 ms

Prettier clean across all 35 changed files. ESLint is wired through lint-staged for src/**/*.ts?(x) only, so it doesn't apply to a .scss-only diff.

Post-build check confirming the fix reaches the emitted stylesheets:

=== var(--sds-fw-*) in emitted CSS ===
  70 index.min.css:var(--sds-fw-medium)      16 638.min.css:var(--sds-fw-medium)
  14 index.min.css:var(--sds-fw-regular)      8 638.min.css:var(--sds-fw-regular)
   8 index.min.css:var(--sds-fw-semi-bold)    7 638.min.css:var(--sds-fw-semi-bold)
   5 index.min.css:var(--sds-fw-light)        2 638.min.css:var(--sds-fw-bold)
   1 index.min.css:var(--sds-fw-bold)

The only remaining --font-weight-* in the emitted CSS is the DeleteModal color: line above, as expected.

Not run: the Playwright E2E suite. Given this shifts type weight app-wide, any screenshot baselines should be checked before merge.

Draft because

Filed as a draft so the weight changes can be eyeballed on-device first — particularly the five light sites going thinner.

🤖 Generated with Claude Code

The SCSS in extension/src referenced `var(--font-weight-light|regular|
medium|semi-bold|bold)`, but none of those custom properties are defined
anywhere: not in extension/src, not in @stellar/design-system, and not in
Tailwind's emitted output. Tailwind v4 prunes unused theme variables, and
the only font-weight variable that reaches the `:root, :host` block in the
built bundle is `--font-weight-semibold: 600` -- a different spelling from
the `--font-weight-semi-bold` this repo used.

Because `font-weight` is an inherited property, each of these declarations
was invalid at computed-value time, resolved to `unset`, and fell back to
the parent's weight (usually 400). The intended weights were silently never
applied.

Swap them for the Stellar Design System tokens, which are defined in
styles.min.css and were already used elsewhere in the popup:

  --font-weight-light      -> --sds-fw-light      (300)   5 sites
  --font-weight-regular    -> --sds-fw-regular    (400)   7 sites
  --font-weight-medium     -> --sds-fw-medium     (500)  44 sites
  --font-weight-semi-bold  -> --sds-fw-semi-bold  (600)   2 sites
  --font-weight-bold       -> --sds-fw-bold       (700)   1 site

Also fixes a mistyped `var(--sds-font-weight-medium)` in
accountHistory/TransactionDetail, which was broken for the same reason.

This is a real visual change, not a refactor: text at the medium/semi-bold/
bold sites gets heavier, and the five large display-numeral sites that asked
for `light` get thinner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-95076905901e55bc9bcb (SDF collaborators only — install instructions in the release description)

CassioMG added a commit that referenced this pull request Aug 8, 2026
Brings the Home screen chrome to parity with the Figma design (node
9567:17044), plus the empty-state and list frames (9569:38124, 9569:37947).

Styling:

- Top nav: all three icon buttons now render 16px white icons. They were
  inconsistent because the size override keyed off `AccountHeader__dropdown`,
  which the history button isn't wrapped in, leaving it at the SDS NavButton
  default of 20px while its neighbours sat at 12px. Styling now hangs off the
  shared `__icon-btn__left` row.
- Account row: 16px avatar on gray-03 with no border (was 24px bordered), 12px
  gray-09 chevron, 6px gap.
- Action tiles: fill the row, no border, 78px tall, 24px lilac-11 icons. Three
  separate rules were keeping them from stretching -- the NavLink grid item, the
  tile inside it, and `__account-info__details`, which is content-sized under
  `justify-content: space-around`. Swap glyph switched to RefreshCw02 to match
  the design.
- Dropped the divider under the tab row.
- Action labels are 12px per Figma's Text/XS/500 (were 14px).
- Added a hover highlight on the action tiles (gray-03 -> gray-04), matching the
  convention already used by `AccountHeader__options__item`.

Spacing, all measured in a 360x600 render against the Figma node geometry:

- Nav buttons -> account row: 24px -> 48px.
- Tab strip -> panes: `AccountTabs` had 12px of bottom padding that
  double-counted against each pane's own top offset, pushing all four panes 12px
  low. Removing it corrects the token list, collectibles list and both empty
  states at once. Both empty states also needed their own trims and now land at
  the same offset, so switching tabs no longer shifts them.
- Floating pill: 16px -> 24px from the bottom.

The floating pill also needed a positioning fix. It was `position: absolute`
inside the scrolling inset, so it rode along with the list. Home has no inner
scroll container at all -- `.View--scrollable` resolves to `height: auto` against
an unsized body, so `.View` grows and the document scrolls -- which means
re-parenting alone wasn't enough. It is now rendered outside `View.Content` and
pinned with `position: fixed`. Verified: window scrolled 500px, pill unmoved.

Weights use `--sds-fw-*`; the `--font-weight-*` custom properties these files
previously referenced are undefined and silently resolved to inherit. The
repo-wide cleanup is #2946.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CassioMG added a commit that referenced this pull request Aug 8, 2026
…tible

- Tiles -> tab strip is 28px where Figma (9567:17044) has 24px: the Balance
  frame closes with 24px and the tab strip adds nothing, but we were stacking
  `__actions` padding-bottom (16px) on `AccountTabs` padding-top (12px).
  `AccountTabs` is now flush and the 24px is owned solely by the tiles, which
  also matches how the 24px below the strip is owned by the panes. Measured with
  the MobileAppBanner dismissed, since Figma has no banner.

- The floating pill's "+" rendered at 1.33px, not the 2px Figma draws. SDS icons
  carry a 24x24 viewBox, so a 16px box scales strokes by 2/3 and the authored
  `stroke-width: 2` shrinks. Authoring 3 renders as 2px. (Computed style reports
  the authored value, so this is invisible unless you account for the viewBox.)

- Added a hover highlight to the floating pill, matching the action tiles.

- Add Collectible: autofocus the Collection address input on open, and give the
  content inset the existing `hasTopInput` variant instead of `hasNoTopPadding`
  so the input's 4px focus ring isn't clipped by the zero-padding inset.

- "Show hidden" now renders at its intended 500 weight. It asked for
  `--font-weight-medium`, which is undefined and silently resolved to inherit;
  the same applied to the helper text below it. See #2946 for the repo-wide
  sweep -- these two sites aren't on that branch.

Verified in a 360x600 render: tiles -> tabs 24px, tabs -> first row box 12px,
pill 24px off the bottom and its glyph stroke rendering at exactly 2px, pill
hover transitioning, address input holding focus on mount, its focus ring
clearing the inset by 4px, and "Show hidden" computing to 500 / lilac-11.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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