Repository navigation
fix(php-transformer): keep a centered button's margins inside its block-flow item - #3770
Merged
Merged
Conversation
chubes4
force-pushed
the
fix/centered-button-wrapper-margins
branch
from
October 29, 2026 22:31
b9605e5 to
408d4d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3767.
What
registerNativeButtonStyleRulefilled the synthesizedcore/buttonswrapper (width:100%) whenever an inline-level control was centered by inheritedtext-align. Author CSS also projects the control's side margins onto that wrapper. In block flow the result was 100% wide plus its margins: the wrapper overflowed and pushed the button off center.The flex wrapper already spans its line when the source parent is a block container (block, flow-root, list-item, inline-block, table-cell). It now gets
width:100%only when the parent lays out items differently, such as flex or grid. The button itself still shrink-wraps its label, and the restatedjustifyContentstill centers it.inherited-text-align-button-justification.phpasserted the exactwidth:100%rule. That assertion is dropped. The test's own "wrapper is not pinned to max-content" assertion still guards the behavior it protects. A browser check of its markup gives the same x for source, trunk and this PR: nested 328/328/328, direct 328/328/328, flex parent 0/0/0.Evidence
New
tools/visual-parity/tests/centered-button-margins.mjswith thetests/fixtures/centered-button-margins.htmlfixture. Each pair is[li width, button offset within li]:liReal site: the dyrefondet.dk donation-amount buttons sit 4 px right of the source on the current import. With this PR, #3756 and #3768 together, five reduced variants of that row (block/flex-column parents, shared and scoped margin rules, a fixed-width ancestor) match the source x positions exactly.
composer test:unit,composer parity, the visual-paritynpm testand phpstan all pass, and phpcs on the changed file is clean.AI assistance: Claude (Fable) via Pi (Roadie) found the issue, wrote the fix and test, and ran the verification; Chris Huber directed.