fix: replace the dead text-md and font-regular typography classes - #2629
fix: replace the dead text-md and font-regular typography classes#2629camielvs wants to merge 1 commit into
text-md and font-regular typography classes#2629Conversation
🎩 PreviewA preview build has been created at: |
Follow-up: added a
|
| site | what it is |
|---|---|
TaskNodeCard.tsx:238 |
"Beta" pill |
SidebarSection.tsx:27 |
section heading |
DashboardComponentsView.tsx:65 |
uppercase eyebrow label |
DashboardComponentsView.tsx:153 |
folder name |
TableVisualizer.tsx ×2 |
table column headers (introduced earlier in this PR) |
weight="medium" is now a variant and all six use it. This also removes the last raw-className weight override in the codebase, which matters beyond tidiness: a weight set via className only wins by twMerge ordering, and that indirection is what let font-regular go unnoticed in the first place.
Also converted two className="font-light" sites (TaskNodeCard.tsx:248, :256) that duplicated the already-existing light variant.
Unchanged rendering
Each conversion was checked with a twMerge probe comparing the old variant-plus-className string against the new one. All five distinct patterns resolve to an identical class set:
IDENTICAL TableVisualizer font-medium -> font-medium
IDENTICAL TaskNodeCard beta font-medium -> font-medium
IDENTICAL TaskNodeCard light font-light -> font-light
IDENTICAL SidebarSection font-medium -> font-medium
IDENTICAL Dashboard eyebrow font-medium -> font-medium
An AST re-scan confirms no weight className remains on any Text/Paragraph/Heading in src. The guard test now covers medium alongside the other four steps.
pnpm run typecheck, lint, format clean; pnpm run test 192 files / 1990 passed.
03eb0b0 to
415d64a
Compare
415d64a to
6f2bdf2
Compare
morgan-wowk
left a comment
There was a problem hiding this comment.
🤖 Agent review. The core dead-class swap (text-md→text-base, font-regular→font-normal) is correct, and the 13 same-set preservation edits check out. But flipping the defaults from 'inherit' to explicit 16px/400 has a blast radius beyond what was audited (inline).
6f2bdf2 to
a18debe
Compare
|
^ I've checked every call site relying on the default
All now pass their size explicitly. Two unrelated things in the diff also fixed: the beta badge had lost its dark-mode styling, and |
`text-md` and `font-regular` resolve to no Tailwind token, so they compiled to nothing and the affected elements silently inherited their font-size/weight. Replaces them with the real tokens (`text-base`, `font-normal`) and adds a test so an invented scale step cannot ship again. Where an ancestor overrode font-size or weight, the previously-inherited value is now made explicit at the call site so rendering is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0c3fb41 to
7ff795a
Compare

Resolves B2 of #2626.
The bug
textVariantsinsrc/components/ui/typography.tsxmappedsize="md"totext-mdandweight="regular"tofont-regular. Neither is a Tailwind v4 token — the default theme defines--text-xs/sm/base/lg/xl/2xland--font-weight-light/normal/semibold/bold. There is no--text-mdand no--font-weight-regular.A class with no matching token compiles to nothing. So every
<Text>,<Paragraph>,<Heading level={1}>and<Link>on the default size/weight emitted a class that did not exist, and inherited its font-size and weight from an ancestor instead. It failed silently, and was copied fromtypography.tsxintolink.tsxbefore anyone noticed.The fix
textVariants.size.mdtext-mdtext-basetextVariants.weight.regularfont-regularfont-normallinkVariants.size.mdtext-mdtext-baseAppMenuCopyTexttext-mdtext-basetext-baseis 1rem/1.5 andfont-normalis 400 — identical to what Preflight already gives an element that inherits (html { line-height: 1.5 },h1..h6 { font-size: inherit; font-weight: inherit }, nobodyfont-size). So on its own this change is a visual no-op except where an ancestor overrode font-size or weight; there, the element used to pick up the ancestor's value and would now snap to 1rem/400.Preserving current rendering
I walked every
.tsxinsrcwith the TypeScript AST, tracking each typography primitive's ancestor chain — including ancestors contributed by wrapper components that put a font utility on the element wrapping{children}(InfoBox's body istext-sm,TooltipContentistext-xs,DialogTitleistext-lg font-semibold,TableHeadisfont-medium, …). 13 elements across 9 files would have changed. Each now states the value it previously inherited:InfoBoxbody (text-sm) →size="sm"—PipelineValidationList×2,ExamplePipelines×2,FeaturedExamples,IOSection×2,RemoteAuthErrorView,PipelineRun×2,RunViewV2×2. (A sibling inPipelineValidationListalready wrotesize="sm"explicitly, confirming the intent.)InfoBoxwithclassName="text-xs"→size="xs"— the three inline<Link>s inManualSubmissionInstructions.TooltipContent(text-xs) →size="xs"—BetaFeatureWrapper, matching its two siblings.DialogTitle(text-lg font-semibold) →size="lg" weight="semibold"—ComponentQuickDetailsDialog.TableHead(font-medium) →className="font-medium"—TableVisualizer×2.Text's weight scale has nomediumstep, so this one cannot be expressed as a prop.Cases that look like nesting but are not, and were verified to need no change:
asChild(<Button asChild><Link>,<DialogDescription asChild><Paragraph>) — Radix merges onto the same element, andcn(variants, className)puts the incoming class last, so twMerge lets the wrapper'stext-xs/text-smwin.CopyTextforwardsclassNameinto its inner<Text>, so all 9 call sites are same-element merges; verified per-site with atwMergeprobe.[&_.text-sm]:text-xs!(FlexNodeDetails,RecentRunsContent) keys off the emitted class name and only matches.text-sm. Confirmed no selector anywhere insrckeys on.text-baseor.font-normal.The guard
src/components/ui/typography.test.tsxreads the token tables Tailwind actually compiles from (node_modules/tailwindcss/theme.css+src/styles/global.css, plustailwind.config.jsonly whenglobal.csscarries an@configdirective — see #2628), renders every step ofText,Paragraph,HeadingandLink, and asserts each emits a font-size/weight class that resolves to a real token. A final pair of cases bans the two dead class names fromsrcoutright.Mutation-tested: restoring
text-md/font-regularintypography.tsxfails 6 of the 23 cases — both the scale assertions and the ban, independently.Note
The issue proposed enforcing this with an ESLint
no-restricted-syntaxrule. That would not have worked:no-restricted-syntaxis already configured forREACT_COMPILER_ENABLED_GLOBS, which explicitly includessrc/components/ui/typography.tsxandsrc/routes/**, and flat config replaces a rule's options rather than merging them — so the new rule would be silently disabled in the very file it protects. CI also runspnpm run lintwithout--max-warnings, so its"warn"severity could not fail the build. A test achieves the intent without either hole.Verification
pnpm run typecheck— cleanpnpm run lint— cleanpnpm run test— 192 files, 1989 passed🤖 Generated with Claude Code