[css-grid] Don't expand flexible tracks under a min-content constraint · Issue #3683 · w3c/csswg-drafts (original) (raw)
Consider this code: https://jsfiddle.net/wjthokzf/
#wrapper { width: 0; } #grid { display: grid; float: left; grid-template-columns: minmax(0, 1fr); border: solid; } #item::before, #item::after { content: ''; float: left; height: 50px; width: 50px; }
The grid is sized under a min-content constraint. The sizing algorithm reaches https://drafts.csswg.org/css-grid/#algo-flex-tracks with a base size and growth limit of 0 for the column.
The free space is indefinite, so the used flex fraction is the result of finding the size of an fr, called with the column and the max-content contribution of the item (100px) as the space to fill. The leftover space is 100px, the flex factor sum is 1, the hypothetical fr size is 100px, and this is what the algorithm returns. So the flex fraction is 100px. And the base size of the column is set to 100px.
However, neither Chromium, Firefox nor Edge do this. The column is 0px wide.
So I think that this "Expand Flexible Tracks" step should only happen if the available space is definite, or if the grid is being sized under a max-content constraint. But not when under a min-content constraint.