Repository navigation
Conversation
Move CssFontShorthand into the shared Css layer so WordPressSitePlan can parse shorthand values, and rewrite only the exactly matching family part of a custom property in place. Non-matching values fall through to the existing colour token binding. Fixes #5215
chubes4
force-pushed
the
fix/issue-5215-font-shorthand-preset
branch
from
November 9, 2026 18:43
c2276bd to
38c8c50
Compare
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.
Fixes #5215.
Root cause
PresetBinding::bindStylesheet()binds colour literals inside custom properties, but never the font-family part of a custom property that holds afontshorthand (--t:normal normal normal 18px/1.6em Example Light,Example,sans-serif, consumed asfont:var(--t)). Text styled through such tokens never follows a Global Styles font change. On a real multi-page import, about 120 of 190 text elements on the home page are styled this way.Change
CssFontShorthandfromHtmlToBlocks\Styleto the sharedCsslayer. It depends only onCss\CssValueSplitter, and the layer-direction contract forbidsWordPressSitePlanfrom importing conversion internals. It now reports the family's offset so the value is never reserialized.PresetBinding, when a custom property value parses as a font shorthand whose complete family stack exactly matches a font-family preset, rewrite only that family in place:--t:normal normal normal 18px/1.6em var(--wp--preset--font-family--body). Style, weight, size, line-height, spacing and!importantstay literal. Values that don't match fall through to the existing colour-token binding unchanged.Evidence
New contract
tests/contract/preset-binding-font-shorthand-custom-property.php(auto-discovered bytests/run.php):--t:normal normal normal 18px/1.6em Example Light,Example,sans-serif→ fails ("Style, weight, size, line-height, spacing and priority survive family binding.")--t:normal normal normal 18px/1.6em var(--wp--preset--font-family--body)→ passes. Unmatched stacks and primary-family-only matches stay literal,color:rgb(var(--c))keeps its preset binding, and--sh:0 0 2px #2f2e2ekeeps its colour-token binding.composer test:scriptspasses on the Lab runner after rebasing on trunk (1313 tests, 0 failed), andcomposer lintreports no errors.AI disclosure: the fix was produced by a Homeboy cook (OpenAI GPT via the Lab runner). Claude (Anthropic Claude Opus, in Claude Code via Roadie) reviewed it, found and fixed a regression where non-font custom properties lost colour binding, added the shadow assertion, ran the Lab suite, and opened this PR with the maintainer's approval after the cook's final gate failed on a Lab transport error.