Skip to content

--font-sans: Inter and --font-mono: JetBrains Mono are declared in the theme but never loaded anywhere (no next/font, @font-face, or Google Fonts link) #1242

Closed

Description

@rawdaymx

Summary

packages/ui/src/styles/default.css declares --font-sans: Inter, sans-serif; and
--font-mono: JetBrains Mono, monospace; in its @theme inline block. Neither font is ever
actually loaded by the application: there is no next/font import, no @font-face rule, and no
Google Fonts (or any other webfont host) <link>/@import anywhere in apps/builder/src or
packages/ui/src. On a machine that happens to have Inter installed as a system font (common on
recent macOS/Windows since some apps ship it, and trivially true on any developer's machine that
has used a lot of modern web tooling), the UI silently looks correct and this goes unnoticed. On
a machine without it — the actual common case for most end users — every element falls through
the sans-serif generic to whatever system default the browser picks (Helvetica on macOS,
Arial on Windows/most Linux), with different metrics (x-height, character width) than Inter was
designed and spaced for.

Control that isolates this to loading, not to the token declaration being wrong: the token names
and fallback stacks (Inter, sans-serif / JetBrains Mono, monospace) are exactly right for
what the design presumably intends — the problem is that nothing on the loading side ever
fetches the actual font files.

Environment

Defect type Static (code) — confirmed absent from the repository; also observed as a live symptom
Commit 975c7a02a963d80bf140bb269d773b4912b8e7b6 (upstream/main)
How measured (static) git fetch upstream && git rev-parse upstream/main, then git grep across apps/builder/src and packages/ui/src at that commit
How measured (live symptom) A self-hosted deployment of the ghcr.io/chatbotxio/*:latest images, browser DevTools console, checked on an earlier date than the commit above (see "What we did not verify" for the digest caveat)

How to see it

  1. packages/ui/src/styles/default.css lines 56-57:
    --font-sans: Inter, sans-serif;
    --font-mono: JetBrains Mono, monospace;
  2. Search the whole loading surface for anything that would actually fetch these fonts:
    $ git grep -n -E "next/font|@font-face|fonts.googleapis" upstream/main -- apps/builder/src packages/ui/src | wc -l
    0
    
  3. In a running instance, open DevTools and check document.fonts:
    document.fonts.size            // 0
    [...document.fonts].length     // 0
    getComputedStyle(document.body).fontFamily  // "Inter, sans-serif" (the name is set; nothing backs it)

Evidence

$ git grep -n -E "next/font|@font-face|fonts.googleapis" upstream/main -- apps/builder/src packages/ui/src | wc -l
0

Witness that the search mechanism itself returns results for a related, present string in the
same file (i.e. this isn't a broken query returning a false zero):

$ git grep -n "font-sans" upstream/main -- packages/ui/src/styles/default.css
upstream/main:packages/ui/src/styles/default.css:56:  --font-sans: Inter, sans-serif;

Live symptom (self-hosted deployment of the ghcr.io/chatbotxio/*:latest images, /auth/sign-in):
document.fonts.size === 0, the loaded-fonts list is empty, and the rendered body text uses the
platform's generic sans-serif substitute rather than Inter.

The document.fonts.check() trap — worth flagging because it is the obvious first thing
anyone would try to confirm this, and it lies:

document.fonts.check('14px Inter')                    // true
document.fonts.check('14px "Schibsted Grotesk"')       // true — a font this app doesn't even reference
document.fonts.check('14px "Definitely Not A Font"')   // true

check() returns true whenever no @font-face rule conflicts with the request — it does
not mean the family is actually available, it means nothing declared otherwise. The reliable
check is document.fonts.load(), whose returned array length reflects fonts actually resolved:

(await document.fonts.load('14px Inter')).length      // 0

Anyone verifying "is the font loading" with .check() will get a false positive.

Where it comes from

packages/ui/src/styles/default.css, lines 56-57 (commit
975c7a02a963d80bf140bb269d773b4912b8e7b6). The absence spans the entire loading surface
(apps/builder/src, packages/ui/src) — there is no single missing line to point at, which is
itself the finding: the token references a font family with a name, and nothing else in the
codebase knows about it.

Why we think this is a defect rather than the intended design

If the intent were "use the browser's default sans-serif," the token would read
--font-sans: sans-serif; or name the actual system-font stack, not a specific commercial
webfont (Inter) that has to be fetched from somewhere. Declaring a named font family without a
loading mechanism produces a UI that renders differently (and, per Inter's own design notes,
noticeably worse — Inter's metrics are tuned for its own x-height and are not the same as
Helvetica's or Arial's) depending on what the visitor's OS happens to ship, which is not
something a design system would choose on purpose.

Suggested fix

We're intentionally not prescribing which of the two standard approaches to take, since it's a
maintainer call between two reasonable options:

  1. Load it with next/font/google in apps/builder/src/app/layout.tsx (the idiomatic Next.js
    answer — self-hosts the font automatically and sets the CSS variable at build time), or
  2. Replace Inter in the token with an explicit system-font stack (e.g. -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) if a bundled webfont was never actually
    intended.

Either fix is small and testable with the same document.fonts.load() check used above.

What we did not verify

  • Rendering on Windows and Linux specifically — the reasoning above (different metrics per OS
    default) follows from how font stacks work, but we did not capture side-by-side screenshots on
    those platforms.
  • The exact deployed image digest for the live-symptom observation — it predates the commit
    cited in Environment and its sha256: was not recorded at the time; the static (repository)
    measurement above is commit-pinned and is what this issue's static claim relies on.
  • Whether any environment ships Inter as a genuine system font widely enough to make this
    invisible in practice for most users — we're asserting the mechanism is broken (nothing loads
    the font), not measuring what fraction of real users are affected.

Related issues — none of these describes it

Searched gh search issues --repo ChatbotXIO/ChatbotX "<term>" for font not loaded, Inter font, and next/font (no --state filter); all three returned zero results. Witness that the
mechanism works: the same command with "bug" returns real issues (e.g. #1226, #1228).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions