Repository navigation
Block Supports: Add the translate feature to the transform block support - #15465
Draft
aaronrobertshaw wants to merge 8 commits into
Draft
aaronrobertshaw wants to merge 8 commits into
aaronrobertshaw wants to merge 8 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
from
November 4, 2026 13:41
89131d3 to
3f8a7ea
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 5, 2026 08:47
3f8a7ea to
2826238
Compare
…ort. Adds X and Y offsets to the transform block support. Each offset is output as the individual translate property, so it combines with a rotation and with any transform a block already applies. Each axis is limited to a single length or percentage in the style engine, WP_Theme_JSON and KSES.
aaronrobertshaw
force-pushed
the
backport/86282-transform-translate
branch
from
November 5, 2026 10:08
2826238 to
d6f1bcb
Compare
…set axis. A block that set only one translate axis reset the other to 0, even when Global Styles set it. The block now fills its missing axis when it is output, from Global Styles, and a state fills first from the block's own value. Global Styles also keep a valid offset for users without unfiltered_html. See #66467.
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 three commits are 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. It outputs the
translateCSS property. So an offset combines with a rotation and with existing block transforms.This PR backports:
translatefeature in the transform block support,WP_Theme_JSON::remove_insecure_properties(), so users withoutunfiltered_htmlcan save it,transform.translateinWP_Theme_JSONsettings and styles, keeping only thexandyaxes,transform.translatestyle engine definition, with one length or percentage per axis,translateinsafecss_filter_attr(), limited to one or two lengths or percentages,WP_Theme_JSONtests.The block opt-ins, the
transform.translatesetting in Core'stheme.jsonand the editor UI arrive later with the Gutenberg package update.Testing instructions
No Core block opts in yet, so test through theme.json styles.
theme.json, add"transform": { "translate": { "x": "10px", "y": "-50%" } }understyles.blocks.core/group."transform": { "translate": { "x": "5px" } }at the top level ofstyles.global-styles-inline-cssstyle tag contains:root :where(.wp-block-group){translate: 10px -50%;}.translate: 5pxrule. Root transforms are dropped.xvalue tocalc(1px + 2px)and confirm the rule disappears.Without this PR there is no
translaterule at all.A block that sets only one axis keeps the other from Global Styles. The tests cover this, since no Core block opts in yet.
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.