Skip to content

Fix bug with cross-axis alignment when there is space between lines#1993

Open
janarve wants to merge 1 commit into
react:release-v2.0from
janarve:release-v2.0
Open

Fix bug with cross-axis alignment when there is space between lines#1993
janarve wants to merge 1 commit into
react:release-v2.0from
janarve:release-v2.0

Conversation

@janarve

@janarve janarve commented Jul 10, 2026

Copy link
Copy Markdown

The code adds the space between the lines to the lineHeight by:

lineHeight += crossDimLead;

before the item alignment happens, this will fail for center and end alignment (it will extend too far in the cross-axis)

We therefore need to compensate for that for those two align-item cases.

This happened with the combination of

align-items: center (or flex-end)
align-content: space-between (or space-around)
flex-wrap: wrap
(flexbox width needs to be small enough to trigger wrapping)

The code adds the space between the lines to the lineHeight by:

  lineHeight += crossDimLead;

*before* the item alignment happens, this will fail for center and end
alignment (it will extend too far in the cross-axis)

We therefore need to compensate for that for those two align-item cases.

This happened with the combination of

  align-items: center (or flex-end)
  align-content: space-between (or space-around)
  flex-wrap: wrap
  (flexbox width needs to be small enough to trigger wrapping)
@meta-cla meta-cla Bot added the CLA Signed label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant