Skip to content

Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (re-land) (#57015)#57057

Closed
adityasharat wants to merge 1 commit into
facebook:mainfrom
adityasharat:export-D107183851
Closed

Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (re-land) (#57015)#57057
adityasharat wants to merge 1 commit into
facebook:mainfrom
adityasharat:export-D107183851

Conversation

@adityasharat
Copy link
Copy Markdown
Contributor

Summary:
X-link: facebook/yoga#1968

Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in ReactProgressBarViewManager.kt and Instagram-internal ReactSwitchManager.kt — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

This re-land additionally fixes a correctness gap in the original D105720159 design: it claimed "Default configs carry the bit (preserves today's behaviour); existing trees see no change" — but LayoutConformance::Strict in YogaLayoutableShadowNode::resolveErrata returned YGErrataNone, which clears every errata bit including the new MinSizeUndefinedInsteadOfAuto (bit 8). Since react-strict-dom sets experimental_layoutConformance="strict" on every native View, this implicitly opts every RSD-using surface into the new auto-min probe. That's the exact path Airwave's tests took to hit the original NPE.

Change: LayoutConformance::Strict now returns YGErrataMinSizeUndefinedInsteadOfAuto instead of YGErrataNone. Strict mode keeps every other CSS conformance behavior intact; only the new auto-min feature stays opt-in via explicit YGConfig setup. This matches the design pattern Litho uses in the child diff (ComponentsConfiguration.useAutoMinSize flag, gated independently of any strict-mode plumbing).

Original summary follows:

X-link: facebook/yoga#1966

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a YGConfig, every flex item whose main-axis min-{width,height} is undefined receives a content-derived floor — min(min-content, specified-size, max-size) plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new YGErrataMinSizeUndefinedInsteadOfAuto errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to YGErrataClassic so consumers using that constant continue to get the same default. LayoutConformance::Strict also keeps the bit set — the new feature is strictly opt-in, not inferred from strict-mode CSS conformance.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new YGErrataMinSizeUndefinedInsteadOfAuto errata bit on YGConfig.

Differential Revision: D107183851

…nd) (facebook#57015)

Summary:
X-link: facebook/yoga#1968

Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in `ReactProgressBarViewManager.kt` and Instagram-internal `ReactSwitchManager.kt` — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

This re-land additionally fixes a correctness gap in the original D105720159 design: it claimed "Default configs carry the bit (preserves today's behaviour); existing trees see no change" — but `LayoutConformance::Strict` in `YogaLayoutableShadowNode::resolveErrata` returned `YGErrataNone`, which clears every errata bit *including* the new `MinSizeUndefinedInsteadOfAuto` (bit 8). Since `react-strict-dom` sets `experimental_layoutConformance="strict"` on every native View, this implicitly opts every RSD-using surface into the new auto-min probe. That's the exact path Airwave's tests took to hit the original NPE.

Change: `LayoutConformance::Strict` now returns `YGErrataMinSizeUndefinedInsteadOfAuto` instead of `YGErrataNone`. Strict mode keeps every other CSS conformance behavior intact; only the new auto-min feature stays opt-in via explicit `YGConfig` setup. This matches the design pattern Litho uses in the child diff (`ComponentsConfiguration.useAutoMinSize` flag, gated independently of any strict-mode plumbing).

Original summary follows:

X-link: facebook/yoga#1966

Pull Request resolved: facebook#57015

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a `YGConfig`, every flex item whose main-axis `min-{width,height}` is undefined receives a content-derived floor — `min(min-content, specified-size, max-size)` plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to `YGErrataClassic` so consumers using that constant continue to get the same default. **`LayoutConformance::Strict` also keeps the bit set** — the new feature is strictly opt-in, not inferred from strict-mode CSS conformance.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`.

Differential Revision: D107183851
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 3, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jun 3, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jun 3, 2026

@adityasharat has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107183851.

@meta-codesync meta-codesync Bot closed this in b766986 Jun 3, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Jun 3, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jun 3, 2026

This pull request has been merged in b766986.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @adityasharat in b766986

When will my fix make it into a release? | How to file a pick request?

meta-codesync Bot pushed a commit to facebook/yoga that referenced this pull request Jun 3, 2026
…nd) (#1968)

Summary:
X-link: facebook/react-native#57057

Pull Request resolved: #1968

Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in `ReactProgressBarViewManager.kt` and Instagram-internal `ReactSwitchManager.kt` — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

This re-land additionally fixes a correctness gap in the original D105720159 design: it claimed "Default configs carry the bit (preserves today's behaviour); existing trees see no change" — but `LayoutConformance::Strict` in `YogaLayoutableShadowNode::resolveErrata` returned `YGErrataNone`, which clears every errata bit *including* the new `MinSizeUndefinedInsteadOfAuto` (bit 8). Since `react-strict-dom` sets `experimental_layoutConformance="strict"` on every native View, this implicitly opts every RSD-using surface into the new auto-min probe. That's the exact path Airwave's tests took to hit the original NPE.

Change: `LayoutConformance::Strict` now returns `YGErrataMinSizeUndefinedInsteadOfAuto` instead of `YGErrataNone`. Strict mode keeps every other CSS conformance behavior intact; only the new auto-min feature stays opt-in via explicit `YGConfig` setup. This matches the design pattern Litho uses in the child diff (`ComponentsConfiguration.useAutoMinSize` flag, gated independently of any strict-mode plumbing).

Original summary follows:

Pull Request resolved: #1966

X-link: facebook/react-native#57015

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a `YGConfig`, every flex item whose main-axis `min-{width,height}` is undefined receives a content-derived floor — `min(min-content, specified-size, max-size)` plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to `YGErrataClassic` so consumers using that constant continue to get the same default. **`LayoutConformance::Strict` also keeps the bit set** — the new feature is strictly opt-in, not inferred from strict-mode CSS conformance.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`.

Reviewed By: javache, aashay-gaikwad

Differential Revision: D107183851

fbshipit-source-id: 451b86347e24da5504649ba575fb27ae0d2f9853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants