Repository navigation
Spacer: Respect disabled custom spacing sizes when resizing - #84518
salvatorecorsi wants to merge 2 commits into
Conversation
🤖 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. 🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. 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 |
Opened #84520 with the minimal selector fix. |
What?
Part of #54084.
Hide Spacer resize controls when the editor's
disableCustomSpacingSizessetting is enabled, for both vertical and horizontal Spacers.Why?
A theme can set
settings.spacing.customSpacingSizetofalseto 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
settings.spacing.customSpacingSizetofalsein itstheme.json.settings.spacing.customSpacingSizetotrueand 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
3bf249c2, on their first attempt (retry 0): vertical 3.651s, horizontal 3.711s.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:
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.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.