Skip to content

Spacer: Respect disabled custom spacing sizes when resizing - #84518

Open
salvatorecorsi wants to merge 2 commits into
WordPress:trunkfrom
salvatorecorsi:fix/spacer-respect-custom-spacing-sizes
Open

salvatorecorsi wants to merge 2 commits into
WordPress:trunkfrom
salvatorecorsi:fix/spacer-respect-custom-spacing-sizes

Conversation

@salvatorecorsi

@salvatorecorsi salvatorecorsi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What?

Part of #54084.

Hide Spacer resize controls when the editor's disableCustomSpacingSizes setting is enabled, for both vertical and horizontal Spacers.

Why?

A theme can set settings.spacing.customSpacingSize to false to limit spacing to presets. The Spacer's resize handles currently remain available and convert preset dimensions into custom pixel values when dragged.

How?

Use the setting already read by SpacerEdit when deciding whether to render its ResizableSpacer. Preset controls remain available, and resizing remains available when custom spacing sizes are allowed.

Add E2E coverage for vertical Spacers and Spacers inside a Row, checking preset preservation after saving and reloading, preset selection for the vertical Spacer, and dragging after custom spacing sizes are enabled again.

This addresses the resize interactions described in #54084. The separate request to change the initial 100px default is outside this PR.

Testing Instructions

  1. Use a theme with spacing presets, such as Twenty Twenty-Five, and set settings.spacing.customSpacingSize to false in its theme.json.
  2. Insert a Spacer in a post, choose a preset for Height, and select the block. Verify that the bottom resize handle is absent.
  3. Choose another Height preset, save the draft, and reload. Verify that the selected preset is preserved and the resize handle remains absent.
  4. Insert a Row containing a Spacer. Select the Spacer and verify that its horizontal resize handle is absent.
  5. Change settings.spacing.customSpacingSize to true and reload. Verify that both Spacers can be resized by dragging their respective handles.

Testing Instructions for Keyboard

With custom spacing sizes disabled, select the vertical Spacer using List View, then navigate to its Height preset slider in the block settings. Use the arrow keys to select another preset, save the draft, and reload. Verify that the chosen preset remains selected.

Validation

  • Production build.
  • JavaScript type checking and scoped lint/format checks.
  • Manual verification in the local post editor.
  • Both new Chromium Spacer E2E regression cases passed on GitHub Actions on commit 3bf249c2, on their first attempt (retry 0): vertical 3.651s, horizontal 3.711s.
  • The eight other CI workflows passed, including static analysis, unit tests, production builds, performance tests, and Storybook.

E2E suite status

Both new Spacer cases passed on their first attempt. The general E2E suite currently has failures in two unchanged tests, running in separate WordPress/browser instances from the Spacer tests:

  • Classic, shard 4: should insert media, convert to blocks, and undo in one step, classic.spec.js:69. The checkbox locator matches the selected image in both the Media Library and attachment selection, causing a strict-mode violation.
  • Widgets Customizer, shard 7: should handle legacy widgets, customizing-widgets.spec.js:385. The “Test Widget” heading is absent after the assertion timeout, including both retries.

Both assertions are unchanged from the base commit.

Use of AI Tools

OpenAI Codex was used to investigate the issue, implement the change, write the regression tests, and run validation.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Oct 11, 2026
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

👋 Welcome

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @salvatorecorsi! 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.

🎉 Props

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: salvatorecorsi <salvatorecorsi@git.wordpress.org>
Co-authored-by: lancewillett <lancewillett@git.wordpress.org>

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

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 11, 2026
@lancewillett

Copy link
Copy Markdown
Member

Classic, shard 4: should insert media, convert to blocks, and undo in one step, classic.spec.js:69. The checkbox locator matches the selected image in both the Media Library and attachment selection, causing a strict-mode violation.

Opened #84520 with the minimal selector fix.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Spacer Affects the Spacer Block labels Oct 12, 2026

This branch has not been deployed

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

Labels

[Block] Spacer Affects the Spacer Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants