Skip to content

Column: Migrate to width block support - #13411

Open
aaronrobertshaw wants to merge 1 commit into
WordPress:trunkfrom
aaronrobertshaw:add/width-support-to-column
Open

Column: Migrate to width block support#13411
aaronrobertshaw wants to merge 1 commit into
WordPress:trunkfrom
aaronrobertshaw:add/width-support-to-column

Conversation

@aaronrobertshaw

Copy link
Copy Markdown

Backport of Gutenberg PR WordPress/gutenberg#76684

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

This migrates the Column block to the dimensions.width block support.

Columns are in a flex container and size themselves with flex-basis rather than width, so WP_Theme_JSON converts the generated width declaration and sets flex-grow: 0.

This PR backports:

  • flex-basis conversion for column widths in WP_Theme_JSON, covering the block level, block style variations, and variation styles set within a responsive breakpoint
  • accompanying WP_Theme_JSON tests.

The core/column block.json and theme.json changes arrive with the next Gutenberg package update, as they did for the Button block in #12046.

Testing instructions

The core/column block.json and theme.json settings changes land with the next Gutenberg package update, so there is no width control in the editor yet.

This PR is the CSS generation, so test that directly.

  1. Add a column width to a theme's theme.json:
"styles": {
      "blocks": {
              "core/column": {
                      "dimensions": { "width": "25%" },
                      "@mobile": { "dimensions": { "width": "100%" } }
              }
      }
}
  1. Load a page with a Columns block and check the global styles. It should
    contain:
:root :where(.wp-block-column){flex-basis: 25%;flex-grow: 0;}
@media (width <= 480px){:root :where(.wp-block-column){flex-basis: 100%;flex-grow: 0;}}

Without the change these come out as width, which does not size a flex child, so the columns divide the space evenly instead of honouring the width.

Use of AI

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: The mechanical port and test drafting; reviewed and edited by me.

Handle the Column block's width through the `dimensions.width` block
support so it aligns with Global Styles and can be set from theme.json.

Columns size themselves with `flex-basis` rather than `width` because
they live in a flex container, so `WP_Theme_JSON` converts the computed
`width` declaration and pins `flex-grow` to `0`. This runs at the block
level, on block style variations, and on variation styles set within a
responsive breakpoint.

The block.json and theme.json changes arrive separately with the next
Gutenberg package update, following the Button block migration.

Developed in: WordPress/gutenberg#76684

See #66055.
@github-actions

github-actions Bot commented Sep 6, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant