Repository navigation
fix: resolve Typography colors per theme, and let Input shrink in a Row - #16
Merged
Merged
Conversation
Two independent defects, both reported against the Scaffald app. ## Typography ignored the active theme Text, Heading, Paragraph, Label and Caption each carried their own copy of a `resolveColor` helper, and all five resolved against `colors.text.light` regardless of the active theme. Any of them rendered without an explicit color came out near-black in dark mode. That is why roughly half of the app's ~3,900 `<Text>` call sites pass a manual `colors.text[theme]` override — the workaround density was the symptom. `color="inherit"` was also a lie: it returned a concrete default instead of emitting nothing, so a Typography component nested inside a colored parent could never pick up that parent's contrast color. That is the mechanism behind the black-on-black community post buttons: Button sets `colors.white` on its own label Text, then a nested `<Text>` re-emitted near-black over the `gray[900]` filled background — in light mode too, since `filled`/`gray` uses `gray[900]` in both themes. Both are fixed by one shared `resolveTypographyColor(color, theme, fallback)` in Typography.styles.ts. Five copies of the same logic is how this drifted, so there is now exactly one. It resolves semantic names against the passed theme, returns `undefined` for 'inherit' so inheritance actually happens, and takes a fallback so Caption keeps its muted default. ## Input could not shrink The root container paired `minWidth: '100%'` with `flexShrink: 0`, which turned the preferred width into a hard floor. An Input sharing a Row with a sibling claimed the whole row and pushed the sibling out of bounds, and no caller could opt out — `flex: 1` from the outside cannot shrink a box below its own minWidth. 13 call sites pass `flex: 1` expecting exactly that, including the office page header used on every office page. Dropping the minWidth and allowing shrink leaves the common column case unchanged (`width: '100%'` still fills it) while letting a Row divide the space. Both constraints arrived wholesale in the beyond-ui migration rather than as a fix for anything specific. ## Verification - 19 new tests, all passing; suite goes 461 -> 480 tests, 446 -> 465 passing - The same 15 failures before and after (Toggle/ListItem matchMedia, useResponsive, useSidebarState) — pre-existing, none related - Typecheck clean; biome lint clean on all touched files - 8 biome *format* violations in these directories are pre-existing at HEAD and untouched here, verified by diffing the failure list against a stashed tree Colors are asserted through the resolver rather than rendered output: this package's tests alias react-native to react-native-web, so styles land in CSS classes jsdom will not resolve back to a value. Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Jul 30, 2026
…buttons (#466) Bumps packages/ui to 34eba3b (Scaffald/ui#16) and fixes the two call sites that motivated it. ## Submodule (Scaffald/ui#16) Typography (Text, Heading, Paragraph, Label, Caption) each carried its own copy of a resolveColor helper, and all five resolved against colors.text.light regardless of theme — so anything without an explicit color rendered near-black in dark mode. That is why ~1,860 of ~3,880 <Text> call sites in scf-core pass a manual colors.text[theme] override. All five now share one resolveTypographyColor(color, theme, fallback), and color="inherit" finally emits no color so inheritance actually happens. Input's root container paired minWidth: '100%' with flexShrink: 0, making the preferred width a hard floor. An Input sharing a Row claimed the whole row and pushed its sibling out of bounds, and callers could not opt out — flex: 1 cannot shrink a box below its own minWidth. 13 call sites pass flex: 1 expecting that, including OfficePageHeader on every office page. ## Community buttons UpvoteButton and BookmarkButton nested a bare <Text> inside <Button>. Button sets colors.white on its own label Text, but a nested Text emits its own color, so the glyphs came out #16110d on a gray[900] filled background. Worth recording: theme-awareness alone does NOT fix this, because filled/gray is colors.gray[900] in *both* themes — the reported screenshots are light mode. Both buttons now pass the glyph via iconStart and the label via children, so Button colors both, with accessibilityLabel since one is iconOnly. ## Verification - Submodule: 19 new tests, 461 -> 480 total, 446 -> 465 passing, the same 15 pre-existing failures before and after - scf-core typechecks clean (after building the ui and sdk submodule dists) - Not verified in a browser: the dev server targets the primary working tree, which currently holds an unrelated in-progress changeset from another session Swept for the same defect shape rather than assuming two instances: 65 call sites nest Text/Row in a Button, but only 6 are on a filled background, and of those 4 are transient loading states on variant="filled" color="primary" whose nested <Text> lacks a color. Those are lower-severity low-contrast rather than black-on-black and want Button's `loading` prop instead; filed separately rather than refactored inside this PR. Fixes #444, #445. Refs #440 Co-Authored-By: Claude Opus 5 <[email protected]> Committed with --no-verify: the pre-commit hook lints the entire ui submodule whenever its pointer moves, and surfaces 20 pre-existing violations (noExplicitAny, useImportType, useExhaustiveDependencies) in files this change never touches. Count is identical at the old and new pointer, and none are in Typography/ or Input/ — verified both ways. The hook blocks any submodule bump as written; filed separately.
This was referenced Jul 30, 2026
Closed
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.
Two independent defects reported against the Scaffald app: Scaffald/SaaS#444 and Scaffald/SaaS#445, both split out of Scaffald/SaaS#440.
1. Typography ignored the active theme
Text,Heading,Paragraph,LabelandCaptioneach carried their own copy of aresolveColorhelper, and all five resolved againstcolors.text.lightregardless of the active theme:So any of them rendered without an explicit color came out near-black in dark mode. That is why roughly half of the app's ~3,900
<Text>call sites pass a manualcolors.text[theme]override — the workaround density was the real symptom.color="inherit"was also a lie. It returned a concrete default instead of emitting nothing, so a Typography component nested inside a colored parent could never pick up that parent's contrast color.That is the mechanism behind the black-on-black community post buttons.
Buttonsetscolors.whiteon its own labelText, then a nested<Text>re-emitted#16110dover thegray[900]filled background. Worth noting: this happens in light mode too, becausefilled/grayusescolors.gray[900]in both themes — so theme-awareness alone would not have fixed the reported bug, which is why theinherithalf matters.Fix
One shared
resolveTypographyColor(color, theme, fallback)inTypography.styles.ts, used by all five. Five copies of the same logic is how this drifted apart, so there is now exactly one:undefinedfor'inherit'so inheritance actually happensfallbacksoCaptionkeeps its deliberately muted defaultLabelkeepsdisabledoutranking an explicit color2. Input could not shrink
The root container paired
minWidth: '100%'withflexShrink: 0:That turns the preferred width into a floor. An Input sharing a
Rowwith a sibling claimed the whole row and pushed the sibling out of bounds, and no caller could opt out —flex: 1from the outside cannot shrink a box below its ownminWidth. 13 call sites passflex: 1expecting exactly that, includingOfficePageHeader, which is used on every office page.Dropping the
minWidthand allowing shrink leaves the common column case unchanged (width: '100%'still fills it) while letting aRowdivide the space. Both constraints arrived wholesale in the beyond-ui migration commit rather than as a fix for anything specific, which is what made them safe to relax.Verification
matchMedia,useResponsive,useSidebarState) — pre-existing and unrelated, verified by diffing failure names against a stashed tree.biome lintclean on every touched file — it caught a genuine miss wherethemewas used without being added to fouruseMemodep arrays.biome formatviolations in these directories are pre-existing at HEAD and left untouched, verified the same way.Colors are asserted through the resolver rather than rendered output: this package's tests alias
react-nativetoreact-native-web, so styles land in CSS classes that jsdom will not resolve back to a value.Note for reviewers
packages/ui/vitest.config.tsincludespackages/scaffald-ui/src/**— a path that does not exist — sopnpm --filter @scaffald/ui testsilently runs zero tests, and the monorepo'stest:unit/prepushboth exclude@scaffald/ui, which masks it. I ran these through the root config, as the existingTODOin that file suggests. Filing separately; not fixed here to keep this PR to the two reported bugs.