Skip to content

fix: restore the bold font-weight on headings - #58

Merged
moufmouf merged 1 commit into
mainfrom
fix/heading-font-weight
Aug 5, 2026
Merged

moufmouf merged 1 commit into
mainfrom
fix/heading-font-weight

Conversation

@moufmouf

@moufmouf moufmouf commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Headings lost their bold weight between v2 and v3. The Tailwind 3 → 4 migration was meant to be a build-tooling change only, so this is an unintended regression.

Cause

v2's src/baseConfig.ts shipped:

export default {
    corePlugins: {
        preflight: false,
    },
    ...
}

The design system was consumed as a Tailwind plugin, and a plugin's config is merged into the consumer's — so preflight: false applied to whoever installed it. No preflight was ever emitted, and the browser's default h1 { font-weight: bold } came through untouched. Nothing in the design system had to set a heading weight, so nothing did.

Tailwind 4 removed corePlugins entirely, so #50 had no way to carry that setting across. @import "tailwindcss" now emits preflight, including:

h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }

font-weight: inherit resolves through body (which sets no weight) to normal, so every heading renders at 400.

Confirmed against real builds rather than by reading the source: a Tailwind 3.4.13 build with a plugin setting corePlugins.preflight = false emits 0 heading-weight resets (2.6 kB of CSS); the same build without it emits 2 (10.5 kB). The current example build emits preflight's reset at byte 4577.

The published v2 tarball is also worth noting: dist/style/base.css ships its @apply directives unexpanded (the src/base postcss config had no tailwindcss plugin), so consumers resolved them with their own Tailwind — under the design system's preflight: false.

Fix

Set the weight explicitly in src/base/index.css.

Element selectors only (h1–h6), not the .h1–.h6 classes. The browser default only ever applied to real heading elements, so the classes were not bold in v2 either. The design system's own code depends on that: .brick-feature-text_title is @apply h3 font-bold and the pricing header is @apply … h4 … font-bold — both add the weight by hand precisely because the class alone doesn't carry it. Bolding the classes would change those rules, and every consumer's <div class="h2">, on top of the actual fix.

The new rule sits in @layer base after preflight at equal specificity, so it wins there; component-layer overrides still beat it, as they should.

Verified

Computed styles from the built example in Chrome:

Selector Weight
h1–h6 700 restored
div.h3 400 unchanged, matches v2
.feature-content-title (@apply h6 font-light) 300 override survives
.brick-feature-text_title (@apply h3 font-bold) 700 override survives
.btn, .paragraph 400 untouched

Across index.html, all 12 heading elements compute to 700 and no class-only pseudo-heading changed.

Worth flagging separately

The heading weight is the visible symptom, but the underlying change is broader: v3 introduced Tailwind's preflight, which v2 never emitted at all. Everything else preflight resets — img { display: block }, list and border defaults, form-control styling — also changed for consumers on the v2 → v3 upgrade. Enabling preflight is defensible, but it wasn't a deliberate decision here; it fell out of corePlugins disappearing. Other regressions of this family may still be lurking, and the release notes for 3.0.0 don't mention it.

🤖 Generated with Claude Code

Up to v2 the design system shipped `corePlugins: { preflight: false }` in
`baseConfig.ts`, so Tailwind emitted no preflight at all and the browser
default `font-weight: bold` applied to every heading element.

Tailwind 4 removed `corePlugins`, so the migration in #50 could not carry
that setting over. `@import "tailwindcss"` now pulls in preflight, whose
`h1,h2,h3,h4,h5,h6 { font-size: inherit; font-weight: inherit }` leaves
every heading at 400. Nothing in the design system set a heading weight,
because nothing had needed to.

Set it explicitly, on the element selectors only: the browser default
never applied to `.h1`-`.h6`, which is why rules that want the weight on
a non-heading element already add it themselves (`.brick-feature-text_title`
is `@apply h3 font-bold`, the pricing header `@apply ... h4 ... font-bold`).
Bolding the classes too would change those and every consumer's
`<div class="h2">` on top of the fix.

Verified in the example build: h1-h6 compute to 700, `div.h3` stays at 400,
and the deliberate overrides still win from the components layer
(`.feature-content-title` 300, `.brick-feature-text_title` 700).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@moufmouf
moufmouf merged commit bbfa64b into main Aug 5, 2026
2 checks passed
@moufmouf
moufmouf deleted the fix/heading-font-weight branch August 5, 2026 09:16
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