Repository navigation
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
|
On a deeper investigation, I noticed that the theme.json schema and reference docs only allow @tellthemachines @ramonjd you asked in #39926 whether we want to support shorthand at all. Any objection to treating it as tolerated input rather than adding it to the documented format? All in all, I personally thought it would be reasonable to address as currently in this PR. Context for my assessment
How shorthand is handled elsewhere:
Side effects:
|
No objections from me. Thanks for digging up that 2022 discussion. With the benefit of hindsight, I think the approach of "tolerated shorthand without documenting it" is fair enough. Theme creators who set such values will have reasons for going against the schema, and my view is, unless it seriously breaks something, we don't have to turn valid CSS into invalid CSS. |
|
For reference, even core's own |
…and (WordPress#85437) * Global Styles: Preserve individual sides of spacing shorthand * Docs: Record spacing shorthand fix in block-editor changelog * Docs: Record private spacing helper in components changelog * Global Styles: Keep spacing shorthand parsing local --------- Co-authored-by: salvatorecorsi <salvatorecorsi@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: Lena Morita <lena@jaguchi.com>
What?
Closes #40132.
Expand CSS padding and margin shorthand correctly when editing Global Styles dimensions. Changing the left side of
68px 32pxnow preserves68pxon top/bottom and32pxon the right.Why?
The dimensions panel currently copies the entire shorthand string into every side. Editing one side then saves invalid longhand values such as
padding-top: 68px 32px, which changes the untouched sides' rendered spacing.How?
Expand the panel's local and inherited padding/margin values with a small helper inside
block-editorbefore passing them to the existing controls. It preserves whitespace inside CSS functions such ascalc()andvar(). The components package and CSS serialization remain unchanged.Testing Instructions
68px 32px,12px 24px 36px, or12px 24px 36px 48pxin theme.json or a style variation.12px 24pxvalue. Verify the other axis keeps its inherited size.calc()orvar()with spaces remains intact when editing a different side.Testing Instructions for Keyboard
Reach the padding/margin controls with Tab, unlink the sides if necessary, edit the Left side input and press Enter. The other sides must retain their original spacing. Existing controls and keyboard interactions are retained.
Validation
Updated against trunk on October 24 to include the Entity Fields/Actions compatibility fix from #85390. The spacing helper and tests are unchanged, and the related tests, package typechecks, lint and build pass after the merge. The previous Site Editor performance failure occurred in the old trunk comparison baseline; the refreshed CI still needs to complete.
The redundant browser test was removed following review because the jsdom assertions already check the side values passed to
onChange. No full repository suite or Docker E2E run is claimed.Use of AI Tools
OpenAI Codex was used for investigation, implementation, tests, automated validation and an independent automated review. No separate human review by the repository owner is claimed. WordPress maintainer review is requested.
A maintainer with triage access is requested to apply
[Type] Bugfor the label check.