Repository navigation
fix: restore the bold font-weight on headings - #58
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsshipped:The design system was consumed as a Tailwind plugin, and a plugin's config is merged into the consumer's — so
preflight: falseapplied to whoever installed it. No preflight was ever emitted, and the browser's defaulth1 { font-weight: bold }came through untouched. Nothing in the design system had to set a heading weight, so nothing did.Tailwind 4 removed
corePluginsentirely, so #50 had no way to carry that setting across.@import "tailwindcss"now emits preflight, including:font-weight: inheritresolves throughbody(which sets no weight) tonormal, 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 = falseemits 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.cssships its@applydirectives unexpanded (thesrc/basepostcss config had notailwindcssplugin), so consumers resolved them with their own Tailwind — under the design system'spreflight: false.Fix
Set the weight explicitly in
src/base/index.css.Element selectors only (
h1–h6), not the.h1–.h6classes. 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_titleis@apply h3 font-boldand 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 baseafter 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:
h1–h6div.h3.feature-content-title(@apply h6 font-light).brick-feature-text_title(@apply h3 font-bold).btn,.paragraphAcross
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 ofcorePluginsdisappearing. 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