You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Layout measures wrapping height before MinWidth/MaxWidth are applied #164
computeBorderBox (internal/layout/calculate.go) applies a child's MinWidth and MaxWidth after the flex slot is assigned, but neither wrapping measurement site consults them: recomputeTextWrapping in internal/layout/flex.go (both the stretch and non-stretch column branches) and the column branch of Element.HeightForWidth in element_layout.go. The child is measured at the slot width and laid out at the constrained width, so the allocated height is wrong whenever the constraint changes wrapping.
Reproduction: a 29 character text ("aaaaa bbbbb ccccc ddddd eeeee") with WithMaxWidth(15) as a child of a column with WithWidth(20) and a text sibling below it. Result: the text is laid out 15 wide, which wraps to 3 rows, but it is allocated 2 rows and the sibling is placed at Y=2, overlapping the last line. WithMaxWidth(10) gives 5 rows needed and 2 allocated. The numbers are the same with WithAlign(AlignStart) on the column (non-stretch) and with the default stretch. A MinWidth above the slot has the opposite effect: the child is measured narrower than it is laid out and gets extra rows.
Likely fix: at both measurement sites, clamp the measured width with the child's MinWidth and MaxWidth resolved against that width, mirroring computeBorderBox, and add a case for each branch to element_layout_colwrap_test.go and calculate_colwrap_test.go. Predates #162; noted during its review.
Activity
fix(layout): apply min and max width before measuring wrapped height
fix(layout): measure non-stretch children at the width they receive (g…