Repository navigation
Conversation
ide
force-pushed
the
@ide/block-padding-longhands
branch
from
November 29, 2026 04:52
2b1a800 to
280f016
Compare
…al edges `paddingBlockStart` and `paddingBlockEnd` are applied only when `paddingTop` and `paddingBottom` are undefined. The inline-axis longhands set Yoga's `Start` and `End` edges, which Yoga resolves before `Left` and `Right`, so `paddingInlineStart` already wins over `paddingLeft` (over `paddingRight` in RTL). Apply the block-axis longhands whenever they are set, so that on both axes the logical longhand wins over the physical edge. Margin, inset and border widths keep their current order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ide
force-pushed
the
@ide/block-padding-longhands
branch
from
November 29, 2026 10:22
280f016 to
81c4585
Compare
ide
marked this pull request as ready for review
November 29, 2026 12:03
This branch has not been deployed
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.
Summary:
This proposes a change of behavior, not a bug fix: when a style sets both
paddingTopandpaddingBlockStart(orpaddingBottomandpaddingBlockEnd), the block-axis longhand wins instead of the physical edge.Today the two axes disagree.
applyAliasedPropsappliespaddingBlockStartandpaddingBlockEndonly whenpaddingTopandpaddingBottomare undefined, whilepaddingInlineStartsets Yoga'sStartedge, which Yoga resolves beforeLeft(Style::computeLeftEdge), so it already wins overpaddingLeft.The block-axis order comes from #35342, which gave "precedence to specific edges" and described Yoga's precedence as "left > start > horizontal > all". But for padding Yoga resolved
startbeforeleftthen (YGNode::computeEdgeValueForRowat67b8e182fa) and does today, as #41682 notes. This change makes the block axis match the inline one. Yoga has no block-start or block-end edge, so the longhands replace the physical edges inapplyAliasedProps.Web parity
On the web,
padding-topandpadding-block-startset the same side in a horizontal writing mode, and the later declaration wins. React Native flattens styles by key, so no declaration order reaches layout, and neither rule matches the web in every case:mainpaddingTop: 0thenpaddingBlockStart: 8paddingBlockStart: 8thenpaddingTop: 0So this does not improve web parity in general; it changes which order matches. It gives one rule for padding on both axes: the logical longhand wins over the physical edge.
Motivation
A component library compiled with StyleX for React Native carries
paddingTop: 0from a reset beside a component'spaddingBlockStart: 8. React Native applies the 0, and a button is laid out 22 points tall where its design is 38.Scope
This changes padding only.
marginBlockStart/marginBlockEnd,insetBlockStart/insetBlockEndandborderBlockStartWidth/borderBlockEndWidthstill give the physical edge precedence; #59996 gave the border widths that order, and Android'sBorderInsets.ktfollows it. If the direction is right, they should follow; this PR is limited to padding to settle the direction first.The shorthands keep their place:
paddingBlocksets Yoga'sVerticaledge, whichpaddingTopandpaddingBottomstill override, aspaddingLeftoverridespaddingInline(Horizontal).Changelog:
[GENERAL] [CHANGED] -
paddingBlockStartandpaddingBlockEndtake precedence overpaddingTopandpaddingBottom, aspaddingInlineStartandpaddingInlineEnddo overpaddingLeftandpaddingRightTest Plan:
The new
View-paddingBlockLonghands-itest.jslays out a container around a 10×10 child:paddingTop: 0, paddingBlockStart: 8, paddingBottom: 0, paddingBlockEnd: 4puts the child 8 points down in a container 22 tall. Onmainit fails: child at 0, container 10 tall.paddingLeft: 0, paddingInlineStart: 8puts the child 8 points in (passes onmain: the inline-axis order).paddingTopandpaddingBottomalone still apply, andpaddingTop: 2, paddingBlock: 8still gives 2.These pass on this branch, as do
yarn fantom packages/react-native/Libraries/Components/View packages/react-native/Libraries/StyleSheet,flow full-check, ESLint, Prettier andscripts/clang-format.js --check.Not run: iOS or Android builds; the change is in shared C++ layout code, which Fantom runs.