⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@Swoyamjeetcodes
Copy link

What?

Closes #74518

This PR introduces a new experimental helper for Dimensions block support serialization:
__experimentalGetDimensionsClassesAndStyles.

The helper returns { className, style } for dimensions-related block supports when their serialization is intentionally skipped.

Why?

Gutenberg currently provides helper utilities for several block supports (color, spacing, border, shadow, typography) to generate CSS classes and inline styles when serialization is skipped. However, there was no equivalent helper for Dimensions block support (e.g. width, height, min-height, aspect ratio).

As a result, block authors had to reimplement internal logic to correctly apply dimensions styles to inner elements, leading to duplication and inconsistencies across blocks.

This PR fills that gap by providing a dedicated helper that aligns Dimensions with the rest of the Block API.

How?

  • Added a new helper function getDimensionsClassesAndStyles that derives dimensions-related class names and inline styles from style.dimensions.
  • Exposed the helper as __experimentalGetDimensionsClassesAndStyles via @wordpress/block-editor.
  • Implemented conflict resolution logic between aspectRatio and height-related properties to mirror existing internal behavior.
  • Added unit tests covering aspect ratio, width, height, minHeight, and conflict resolution scenarios.

Testing Instructions

  1. Run the block-editor unit tests:
    npm run test:unit packages/block-editor

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Swoyamjeetcodes <[email protected]>
Co-authored-by: mrleemon <[email protected]>

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

@github-actions github-actions bot added the [Package] Block editor /packages/block-editor label Jan 11, 2026
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Swoyamjeetcodes! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 11, 2026
@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Feature] Block API API that allows to express the block paradigm. labels Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block API API that allows to express the block paradigm. First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing helper for Dimensions block support serialization (getDimensionsClassesAndStyles)

2 participants