Re: [csswg-drafts] [css-grid] Intrinsic size of grid containers (#2303)

OK, given the way space is distributed, a maximum as you said may be better.

However, it still doesn't seem completely right. The idea is that, when sizing under a max-content constraint, items shouldn't contribute more space than what they will end up using. But imagine you have a single grid item with a minimum contribution of 20px, a min-content contribution of 25px, and a max-content contribution of 100px. It spans two columns sized with `minmax(auto,min-content) minmax(auto,50px)`.

When sizing the container under a max-content constraint, the limited max-content contribution will be 50px (100px clamped between 20px and 50px). This will be distributed equally, so both columns will end up with a base size of 25px. Then the minimum contribution, 20px, is distributed for growth limits. The 2nd column already has a growth limit of 50px, so it will remain that way, but the first column will change its growth limit from infinity to the base size, 25px. Then the 2nd column will be maximized and the grid container will be 75px wide.

The you do layout for real. This time the `auto` minimums only distribute the minimum contribution, 20px. So the base size of each column becomes 10px. 20px are distributed again for the growth limits, the first one becomes 10px and the 2nd one remains 50px. So this time the columns will sum 60px. This is smaller than the grid container.

IMO the sizing algorithm seems too aggressive reducing the growth limit when it was infinity and becomes finite. If there is free space, the 1st column should probably be allowed to grow until it reaches 25px (the min-content contribution, as dictated by the max track sizing function). This can be an unrelated issue, though.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2303#issuecomment-463403853 using your GitHub account

Received on Wednesday, 13 February 2019 22:36:16 UTC