Open iamralpht opened 1 month ago
I've had an initial look into this. It seems that it's the min-height: 251px
on the parent of #large
that makes this work in Chrome (and, I believe, according to the spec). Of note (not to this particular tree, but in general): without a specified min-height
(or min-width
- whichever is in the main axis) style, the automatic minimum size would take affect and cause the stretching behaviour you don't want.
Quite why this isn't working in Taffy with the min-height
style specified (which it is here) I'm not sure and will require further investigation.
Actually, EITHER a min-height
or overflow: hidden
makes this work properly in Chrome (which makes sense: overflow: hidden
disables the automatic minimum main size for flexbox items.
Oh nice - thanks for investigating this! It took a little while to reduce this, but I can look at creating a gentest if it's helpful.
Oh nice - thanks for investigating this! It took a little while to reduce this, but I can look at creating a gentest if it's helpful.
Don't worry - I'm on that! I actually have one, but working on reducing it further.
I think it reduces down to:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="../../scripts/gentest/test_helper.js"></script>
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
<title>
Test description
</title>
</head>
<body>
<div id="test-root" style="display: flex; flex-direction: column; width: 200px; ">
<div style="display: flex; flex-direction: column; overflow: hidden; min-height: 100px; padding: 20px; flex-basis: 0px;">
<div style="display: flex; height: 200px; flex-shrink: 0;"></div>
</div>
</div>
</body>
</html>
Which we might want to split into two tests (one for overflow: hidden
and one for min-height: 100px
as they both ought to work but neither seem to be working).
That makes sense - I think that overflow: scroll
should behave as overflow: hidden
, too (but I'm guessing they don't need separate tests).
taffy
versiona2378a7
Platform
Rust
What you did
We use taffy for UI layout, and updating from a 0.3 release to 0.5.2 caused a regression in our render tests. It looks like some flex items that used to shrink to be smaller than the size of their content + margins (with flex-basis: 0), no longer do.
What went wrong
In the attached test case, I'm expecting that the box id "#outer" have its height controlled by grandchild "#inner" (so whatever "#inner"'s height is, plus margins). Instead, the box id "#outer" gets the height from box id "#large", which should be clipped instead.
Chrome performs the layout I'm expecting, and what we were seeing with taffy 0.3.