Repository navigation
Block Supports: Add the translate feature to the transform block support - #15465
Draft
aaronrobertshaw wants to merge 9 commits into
Draft
aaronrobertshaw wants to merge 9 commits into
aaronrobertshaw wants to merge 9 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
aaronrobertshaw
force-pushed
the
backport/86282-transform-translate
branch
3 times, most recently
from
November 5, 2026 10:08
2826238 to
d6f1bcb
Compare
Backports the PHP side of Gutenberg PR 86240: the transform block support, the transform.rotate setting and style in WP_Theme_JSON (blocks and block style variations only), the style engine rotate definition, and rotate in KSES limited to a single angle.
Adds the D modifier to WP_Style_Engine::VALID_ANGLE_PATTERN. Without it, $ matches before a final newline, so "45deg\n" passed validation.
aaronrobertshaw
force-pushed
the
backport/86282-transform-translate
branch
from
November 11, 2026 03:45
98c9a3e to
8cd0ea2
Compare
Transforms are for blocks only. Element styles in a block's style attribute, including viewport states, passed their whole style object to the style engine, so a saved or pasted element transform still output CSS. Drop the transform key from element styles before they reach the style engine. See #66468.
aaronrobertshaw
force-pushed
the
backport/86282-transform-translate
branch
from
November 13, 2026 10:13
8cd0ea2 to
c091906
Compare
Transforms now follow border and shadow. The rotation is returned as an inline style by an apply callback, and a block that applies it to an inner element skips serialization and calls wp_get_transform_classes_and_styles(). Feature selectors are left to global styles and block style states. Transform tools are switched on by appearanceTools, and theme.json validates transform values with one style engine call.
…ort. An offset is saved inline like the rotation. It replaces the global styles offset whole, and an axis it leaves out is 0, as in CSS. Transform tools, including translate, are switched on by appearanceTools.
aaronrobertshaw
force-pushed
the
backport/86282-transform-translate
branch
from
November 17, 2026 11:26
c091906 to
d4b30ab
Compare
Each style layer now sets only the axes it has, as --wp--style--translate-x and --wp--style--translate-y, and translate reads both with var(). kses keeps the axis properties and translate with CSS functions.
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.
Important
This builds on #15408 and should land after it. Only the last commit is new for review. The earlier commits belong to #15408.
Backport of Gutenberg PR WordPress/gutenberg#86282
Trac ticket: https://core.trac.wordpress.org/ticket/66467
Adds X and Y offsets to the transform block support. Each axis set outputs its own custom property,
--wp--style--translate-xor--wp--style--translate-y, plustranslate: var(--wp--style--translate-x, 0) var(--wp--style--translate-y, 0). An offset combines with a rotation and with existing block transforms. Each style layer sets only its own axes.This PR backports:
translatefeature in the transform block support, as an inline style. An axis left out comes from global styles or other styles. It is0when none sets it,WP_Theme_JSON::remove_insecure_properties(),transform.translateinWP_Theme_JSONsettings and styles, keeping only thexandyaxes, switched on byappearanceTools,transform.translatestyle engine definition, with one length or percentage per axis,translateinsafecss_filter_attr(), limited to one or two lengths or percentages or CSS functions such asvar(). The two axis custom properties are limited to one length or percentage,The block opt-ins, the setting in Core's
theme.json, the editor UI and the@propertyrules that stop nested blocks inheriting an offset arrive later with the Gutenberg package update.Testing instructions
theme.json, add"transform": { "translate": { "x": "10px", "y": "-50%" } }understyles.blocks.core/group.global-styles-inline-cssstyle tag contains:root :where(.wp-block-group){--wp--style--translate-x: 10px;--wp--style--translate-y: -50%;translate: var(--wp--style--translate-x, 0) var(--wp--style--translate-y, 0);}.xvalue tocalc(1px + 2px)and confirm the rule disappears.Without this PR there is no
translaterule at all.Use of AI
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: The mechanical port, tests and this description; I reviewed and edited the PR.