Skip to content

fix(ui): make monospace text follow custom font family - #5727

Open
rtomas wants to merge 1 commit into
mainfrom
rtomas/fix-custom-font-mono-text
Open

fix(ui): make monospace text follow custom font family#5727
rtomas wants to merge 1 commit into
mainfrom
rtomas/fix-custom-font-mono-text

Conversation

@rtomas

@rtomas rtomas commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Setting a custom base font via --apkt-font-family (or the legacy --w3m-font-family) left every monospace piece of UI text unstyled — the WalletConnect "Copy link" button, wallet addresses, and amount inputs rendered in the browser default (serif) font while all regular text correctly switched to the custom font.

Root cause. The regular font is themeable through --apkt-fontFamily-regular, which ThemeHelperUtil overrides with the custom font. The mono font, however, was hardcoded to KHTekaMono (ThemeConstantsUtilfontFamily.mono) with no corresponding CSS variable, so it could not be themed. On top of that the bundled @font-face blocks are skipped when a custom font is set, so font-family: KHTekaMono pointed at a family that was never loaded — with no generic fallback, the browser dropped to its default serif.

Fix. Mono now resolves to:

--apkt-font-family-mono ?? --apkt-font-family ?? --w3m-font-family ?? KHTekaMono

so the common single-custom-font case keeps mono text styled, while the new --apkt-font-family-mono theme variable still allows explicit monospace control:

themeVariables: {
  '--apkt-font-family': "'Comic Sans MS', cursive",
  '--apkt-font-family-mono': "'Fira Code', monospace" // optional
}

The bundled KHTekaMono @font-face is now gated on whether it is actually the effective mono font, mirroring how the regular faces are already gated. Default behavior with no custom font is unchanged.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

closes #5681

Showcase (Optional)

Before

image

After

image

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Setting --apkt-font-family (or legacy --w3m-font-family) left every
monospace piece of UI text unstyled: the WalletConnect "Copy link"
button, wallet addresses, and amount inputs fell back to the browser
default font.

The mono font was hardcoded to KHTekaMono with no corresponding CSS
variable, so it could not be themed. Since the bundled @font-face
blocks are skipped when a custom font is set, font-family: KHTekaMono
then pointed at a family that was never loaded, with no generic
fallback.

Mono now resolves to
--apkt-font-family-mono ?? --apkt-font-family ?? --w3m-font-family ?? KHTekaMono
so a single custom font keeps mono text styled, and the new
--apkt-font-family-mono variable allows overriding monospace on its
own. The bundled KHTekaMono face is only injected when it is the
effective mono font. Default behavior is unchanged.

Closes #5681

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-demo Ready Ready Preview, Comment Jul 28, 2026 4:48pm
appkit-gallery Ready Ready Preview, Comment Jul 28, 2026 4:48pm
appkit-headless-sample-app Ready Ready Preview, Comment Jul 28, 2026 4:48pm
appkit-laboratory Ready Ready Preview, Comment Jul 28, 2026 4:48pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored Jul 28, 2026 4:48pm
appkit-basic-sign-client-example Ignored Ignored Jul 28, 2026 4:48pm
appkit-basic-up-example Ignored Ignored Jul 28, 2026 4:48pm
appkit-ethers5-bera Ignored Ignored Jul 28, 2026 4:48pm
appkit-nansen-demo Ignored Ignored Jul 28, 2026 4:48pm
appkit-wagmi-cdn-example Ignored Ignored Jul 28, 2026 4:48pm
ethereum-provider-wagmi-example Ignored Ignored Jul 28, 2026 4:48pm
next-wagmi-solana-bitcoin-example Ignored Ignored Jul 28, 2026 4:48pm
vue-wagmi-example Ignored Ignored Jul 28, 2026 4:48pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5150558

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-utils Patch
@reown/appkit Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-common Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-testing Patch
@reown/appkit-ui Patch
@reown/appkit-universal-connector Patch
@reown/appkit-wallet-button Patch
@reown/appkit-wallet Patch
@reown/appkit-controllers Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression Test Results ✅ Passed

⚠️ 20 visual change(s) detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=990
Storybook Preview: https://6493191bf4b10fed8ca7353f-oghjhnysnt.chromatic.com/

👉 Please review the visual changes in Chromatic and accept or reject them.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         75.93 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 422 ms   on Snapdragon 410
Total time:   2 s
@reown/appkit/react
Size limit:   236 kB
Size:         235.17 kB with all dependencies, minified and gzipped
Loading time: 4.6 s     on slow 3G
Running time: 852 ms    on Snapdragon 410
Total time:   5.5 s
@reown/appkit/vue
Size limit:   80 kB
Size:         75.93 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 382 ms   on Snapdragon 410
Total time:   1.9 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         214.44 kB with all dependencies, minified and gzipped
Loading time: 4.2 s     on slow 3G
Running time: 809 ms    on Snapdragon 410
Total time:   5 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.2 kB with all dependencies, minified and gzipped
Loading time: 258 ms  on slow 3G
Running time: 253 ms  on Snapdragon 410
Total time:   510 ms

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.62% 40237 / 51173
🔵 Statements 78.62% 40237 / 51173
🔵 Functions 76.07% 4292 / 5642
🔵 Branches 86.74% 9857 / 11363
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ui/src/utils/ThemeHelperUtil.ts 80.75% 93.28% 90.9% 80.75% 12-13, 188-189, 249-250, 320-392, 477-478, 499-501, 322, 519
packages/ui/src/utils/ThemeUtil.ts 79.52% 80% 100% 79.52% 71-73, 86-105, 108-110
packages/ui/src/utils/TypeUtil.ts 100% 100% 100% 100%
Generated in workflow #17209 for commit 5150558 by the Vitest Coverage Report Action

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.

[bug] Custom font (--apkt-font-family) breaks monospace text: mono is hardcoded KHTekaMono with no variable or fallback

1 participant