Repository navigation
Conversation
a1794ca to
e98bb78
Compare
…accepts theme presets Co-Authored-By: Claude <noreply@anthropic.com>
e98bb78 to
f3df063
Compare
|
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 If 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. |
🤖 PR meta 🤖📦 Bundle sizeSize Change: -228 B (0%) Total Size: 8.24 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
|
Thanks for getting this PR up @t-hamano 🚀 One aside before the review proper. In other recent design tools work, I was seeing that we might need a closer look at how dimension presets interact with the core defaults in Backward compatibility holds up for the most part. Two blockers. BlockersThe resize handle isn't gated with the rest. In your test 3 the control and the Full height button both go, but the drag handle stays. The user can still drag in a value they can't then see or clear, and it renders on the front end. Nothing replaces the 50px floor. The shared That might well be what we want, clearing Cover's minimum height has been asked for often enough. I'd rather it was a decision than a side effect though. Worth fixingTwo knock-ons from the opt-in. Core's Block settings beat root settings, whatever the source. A theme turning Deprecation gaps. The attribute removal needs a dev note. Saved content is fine, anything reading |
Co-Authored-By: Claude <noreply@anthropic.com>
… v14 Co-Authored-By: Claude <noreply@anthropic.com>
|
@aaronrobertshaw Thanks for the review!
I disabled the UI for resizing when
My take is that allowing values below 50px, all the way down to 0, is acceptable. As for the
This applies to any effort to migrate attributes to block supports, doesn't it? I don't think it's an issue, as consumers can decide for themselves which npm version to use outside of WordPress.
Once this PR is merged, I would like to summarize the key points for consumers in a dev note.
I think
Addressed in 734ec9e |
What?
Move the Cover block's minimum height from the
minHeightandminHeightUnitattributes to thedimensions.minHeightblock support.Why?
dimensions.minHeightis already supported by several blocks, and its control offers the presets a theme defines indimensions.dimensionSizes. Cover is the only block that stores a minimum height as its own attribute, so those presets are unavailable to it.The presets could be wired into the existing attribute with
useSettingsand a preset-aware control, but re-implementing what the block support already provides did not feel right.How?
dimensions.minHeightisfalseby default, and Cover has to keep offering a minimum height to every theme as it does today. The block therefore opts in at the block level inlib/theme.json, the same approach taken for the Button block's width support in #74242 and the Icon block's width setting in #75665.Testing Instructions
Each step replaces
test/emptytheme/theme.jsonwith the JSON shown.1. Theme presets are available on Cover
{ "version": 3, "settings": { "appearanceTools": true, "dimensions": { "dimensionSizes": [ { "name": "Small", "slug": "small", "size": "clamp(150px, 20vh, 200px)" }, { "name": "Medium", "slug": "medium", "size": "clamp(250px, 40vh, 400px)" }, { "name": "Large", "slug": "large", "size": "clamp(400px, 60vh, 600px)" }, { "name": "Full", "slug": "full", "size": "100vh" } ] }, "layout": { "contentSize": "840px", "wideSize": "1100px" } } }Minimum heightshould present the four presets, and picking one should storevar:preset|dimension|<slug>and render the matchingmin-heightin the canvas and on the front end.2. Block-level presets win over root-level ones
{ "version": 3, "settings": { "appearanceTools": true, "dimensions": { "dimensionSizes": [ { "name": "Root 1", "slug": "root-1", "size": "100px" }, { "name": "Root 2", "slug": "root-2", "size": "200px" }, { "name": "Root 3", "slug": "root-3", "size": "300px" } ] }, "blocks": { "core/cover": { "dimensions": { "dimensionSizes": [ { "name": "Cover 1", "slug": "cover-1", "size": "400px" }, { "name": "Cover 2", "slug": "cover-2", "size": "500px" }, { "name": "Cover 3", "slug": "cover-3", "size": "600px" } ] } } }, "layout": { "contentSize": "840px", "wideSize": "1100px" } } }Cover should offer only the three
Coverpresets. A Group block, which has no block-level override, should still offer the threeRootones.3. A theme can turn the control off
{ "version": 3, "settings": { "appearanceTools": true, "blocks": { "core/cover": { "dimensions": { "minHeight": false } } }, "layout": { "contentSize": "840px", "wideSize": "1100px" } } }Minimum heightshould disappear from the Dimensions panel, theFull heightbutton should disappear from the block toolbar, and the resize handle at the bottom of the selected Cover block should no longer appear. The Group block keeps its ownMinimum height.Screenshots or screencast
min-height-block-support.mp4
Use of AI Tools
The change was implemented with Claude Code, then reviewed and tested by me. The commit carries a
Co-Authored-Bytrailer.