Skip to content

Block Supports: Add the transform block support with a rotate feature - #15408

Open
aaronrobertshaw wants to merge 5 commits into
WordPress:trunkfrom
aaronrobertshaw:backport/86240-transform-block-support
Open

aaronrobertshaw wants to merge 5 commits into
WordPress:trunkfrom
aaronrobertshaw:backport/86240-transform-block-support

Conversation

@aaronrobertshaw

@aaronrobertshaw aaronrobertshaw commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Backport of Gutenberg PR WordPress/gutenberg#86240

Trac ticket: https://core.trac.wordpress.org/ticket/66468

Adds a transform block support with a single rotate feature. Blocks that opt in can be rotated by one angle. It outputs the rotate CSS property, not the transform shorthand, so existing block transforms still apply.

This PR backports:

  • the new transform block support,
  • transform.rotate in WP_Theme_JSON settings and styles, for blocks and block style variations only (not the root or elements),
  • the transform.rotate style engine definition, limited to a single angle,
  • rotate in safecss_filter_attr(), limited to a single angle,
  • and the accompanying block supports, states, style engine, KSES and WP_Theme_JSON tests.

The block opt-ins (Group, Heading, Image and Video block.json), the transform.rotate setting in Core's theme.json and the editor UI arrive later with the Gutenberg package update.

Testing instructions

No Core block opts in yet, so test through theme.json styles.

  1. In the active theme's theme.json, add "transform": { "rotate": "15deg" } under styles.blocks.core/group.
  2. Also add "transform": { "rotate": "5deg" } at the top level of styles.
  3. View a page that contains a Group block.
  4. Check the global-styles-inline-css style tag contains :root :where(.wp-block-group){rotate: 15deg;}.
  5. Check there is no rotate: 5deg rule. Root transforms are dropped.
  6. Change the Group value to calc(10deg + 5deg) and confirm the rule disappears. Only a single angle is output.

Without this PR there is no rotate rule 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.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@aaronrobertshaw
aaronrobertshaw marked this pull request as ready for review November 5, 2026 10:23
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props aaronrobertshaw.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

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
aaronrobertshaw force-pushed the backport/86240-transform-block-support branch from 47db68b to 9d0468a Compare November 11, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant