Skip to content

fix(ui): add --apkt-font-family-mono so custom fonts don't break mono text#5682

Open
spennyp wants to merge 1 commit into
reown-com:mainfrom
spennyp:fix/custom-font-mono-text
Open

fix(ui): add --apkt-font-family-mono so custom fonts don't break mono text#5682
spennyp wants to merge 1 commit into
reown-com:mainfrom
spennyp:fix/custom-font-mono-text

Conversation

@spennyp
Copy link
Copy Markdown

@spennyp spennyp commented Jun 3, 2026

Description

Setting a custom base font via --apkt-font-family (or the legacy --w3m-font-family) previously broke every monospace piece of UI text (the WalletConnect "Copy link" button, wallet addresses, and amount inputs): they fell back to the browser default font instead of following the custom font.

Root cause: the regular font is themeable through the --apkt-fontFamily-regular CSS variable, which ThemeHelperUtil.generateW3MOverrides overrides with the custom font. The mono font (--apkt-fontFamily-mono, default KHTekaMono) had no equivalent override, so it kept resolving to KHTekaMono, whose @font-face is dropped once a custom font is set (see #4542). The result was an unloaded family with no fallback.

This adds a --apkt-font-family-mono theme variable that mirrors the regular one and falls back to --apkt-font-family when not provided. So a single --apkt-font-family now also styles monospace text (nothing breaks), while an explicit --apkt-font-family-mono is still respected. Default behavior (no custom font) is unchanged.

Changes (all in packages/ui):

  • utils/ThemeHelperUtil.ts: resolve font-family-mono in normalizeThemeVariables (falls back to the base font), override --apkt-fontFamily-mono in generateW3MOverrides, and publish --w3m-font-family-mono in generateW3MVariables for parity.
  • utils/TypeUtil.ts: add --apkt-font-family-mono and --w3m-font-family-mono to ThemeVariables.
  • tests/ThemeHelperUtils.test.ts: cover the new override (base font only, explicit mono, mono only, no font).

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)

Reproduction (set a custom --apkt-font-family, then open the WalletConnect QR view and note "Copy link" does not follow it): https://stackblitz.com/edit/github-e1adycfs?file=src%2FApp.tsx

Toggling the --apkt-font-family line in that StackBlitz shows the before/after. With this branch, the mono text follows the custom font.

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 3, 2026

🦋 Changeset detected

Latest commit: f2ab8da

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-ui Patch
@reown/appkit-common Patch
@reown/appkit-controllers Patch
@reown/appkit Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-wallet-button Patch
@reown/appkit-experimental Patch
@reown/appkit-pay 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
@reown/appkit-universal-connector Patch
@reown/appkit-utils Patch
@reown/appkit-wallet Patch
@reown/appkit-siwx Patch
@reown/appkit-core Patch
@reown/appkit-cdn Patch
@reown/appkit-testing Patch
@reown/appkit-polyfills Patch
@reown/appkit-cli Patch
@reown/appkit-codemod 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

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

@spennyp is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@spennyp spennyp force-pushed the fix/custom-font-mono-text branch 2 times, most recently from f0e47b2 to fc804ae Compare June 3, 2026 03:10
@spennyp spennyp marked this pull request as ready for review June 3, 2026 03:12
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc804ae039

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ui/src/utils/TypeUtil.ts
@spennyp
Copy link
Copy Markdown
Author

spennyp commented Jun 3, 2026

I have read the CTA Document and I hereby sign the CTA

@spennyp spennyp force-pushed the fix/custom-font-mono-text branch from fc804ae to f2ab8da Compare June 3, 2026 03:22
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