-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Button: Migrate to width block support #74242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
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. |
|
Size Change: +169 B (+0.01%) Total Size: 2.59 MB
ℹ️ View Unchanged
|
SirLouen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Report
Environment
- WordPress: 6.9
- PHP: 8.3.28-dev
- Server: PHP.wasm
- Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
- Browser: Chrome 143.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Five 1.4
- MU Plugins: None activated
- Plugins:
- Gutenberg 22.3.0
- Test Reports 1.2.1
Testing Steps
- Set to 500px the
widthfor the Button Global Style - Created a post with two buttons
- First button set to 100%
- Second button, left default
Actual Results
- ✅ PR is working
Additional Notes
⚠️ Added one improvement for the code.
Supplemental Artifacts
Backend
Frontend
|
Appreciate the speedy reviews everyone 🙇
It definitely isn't but the blocking review was more just a slight difference in process etc. There's been some discussion with @SirLouen on other PRs e.g. #74189 (comment), so I think we're all a little more aligned on that now. That said, it was just an oversight when I was juggling a few things and that duplication definitely shouldn't be there. I'll get it cleaned up soon. Same for the failing e2e test. |
|
Quick update: I've removed the duplication but still have one last failing e2e locally that needs some further debugging. This might not be ready for further review until tomorrow. |
Feedback has been addressed and was non-blocking too
|
Nice work. 🚀 |
|
Thank you for the reviews and testing here 🙇 I'm thinking I might hold off on merging this one for the moment. I'd like to possibly add default width presets for the Button block to match the old toggle group controls UX a little. This could just be a follow-up although I'll be offline for the next week or so and there's no time crunch on landing this. |
|
Looks like there's an edge case with creating presets for individual block types. Defining I'll have to dig into this one further. |



What?
Migrates the Button block from using an ad-hoc
widthattribute to thedimensions.widthblock support.Why?
How?
widthattribute from block.jsondimensions.widthsupport with default controls enabledstyle.dimensions.widthformatTesting Instructions
UX Change
The width control changes from a toggle group with preset buttons (25/50/75/100%) to a dimension control that accepts any value. Themes can restore the preset-based UX by defining dimension sizes in theme.json.
Backward Compatibility
wp-block-button__width-25, etc.) are preserved for percentage valuesScreenshots or screencast
Screen.Recording.2025-12-27.at.12.16.10.pm.mp4