fix(typography): Minor typography foundation corrections - #5068
Open
oleksandrzavarzin-callstack wants to merge 1 commit into
Open
Conversation
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.
Motivation
Small, foundation-level typography corrections identified while auditing the type-scale tokens against Material Design 3, as part of the v6 modernization effort. Body was on the wrong font family, seven emphasized styles were on the wrong font family, and the
TypescaleKeytype didn't expose the emphasized variants that the runtime object already had.Changes
Typography tokens (
src/theme/tokens/ref/typeface.ts,src/theme/tokens/sys/typography.ts)fontFamily/fontWeightback to the right values. Added aplainRegulartypeface entry (Plain @ weight 400) and pointedbodyLarge/bodyMedium/bodySmallat it directly, removing the override.plainMedium). Added abrandMediumtypeface entry (Brand @ weight 500) and repointed the seven affected emphasized styles.regularType,mediumType,emphasizedMediumType,emphasizedBoldType) to<family><weight>Typenames (brandRegularType,brandMediumType,plainRegularType,plainMediumType,plainMediumEmphasizedType,plainBoldType). The old names hid that a single helper was shared across styles MD3 assigns to different families — which is exactly how both bugs above happened.Types (
src/theme/types/typography.ts,src/components/Typography/Text.tsx)TypescaleKeywith the 15*Emphasizedvariants soText'svariantprop type-accepts them (the runtimetypescaleobject already had these keys — this only fixes the type).Emphasizedvariants inText'svariantJSDoc.Docs (
docs/6.x/docs/guides/fonts.md)bodyLargeletterSpacing(0.15→0.5) never updated after feat: add emphasized typescale and fix letter-spacing spec bugs #4920 changed the underlying token.Emphasizedvariants.Visual / behavioral changes
None
Public API
md.ref.typeface.plainRegular,md.ref.typeface.brandMedium(internal ref tokens, exported transitively viaPalette/theme but not part of the documented component API).TypescaleKey(and thereforeText'svariantprop) now accepts 15 additional*Emphasizedvalues that were already valid at runtime.Record<TypescaleKey, …>object from scratch now needs the 15 additional keys.configureFontsis unaffected — all its overloads takePartial<Record<TypescaleKey, …>>.Related issue
(new — to be created)
Note on scope: the emphasized Display/Headline/TitleLarge family fix is included here rather than deferred, because Compose's generated
TypeScaleTokens.kt(VERSION: v0_103) marks all 15*Emphasizedentries provisional under a single// TODO update with the generated tokens once availablecomment — but the family assignment (Brand vs Plain) mirrors the non-emphasized baseline split 1:1 and matches the M3 type-scale spec, so it's a low-risk read even while flagged provisional upstream. Only the family was touched; sizes/line-heights/tracking are untouched.Test plan
yarn typescript(tsc -b)yarn lintyarn test— 55 suites / 733 tests / 169 snapshots pass, no snapshot changestypescaleoutput (ios/android/web) betweenmainand this branch — no visual verification needed since there is no rendering change