[csswg-drafts] [css-grid] Automatic Minimum Size for grid items should not min against content size

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid] Automatic Minimum Size for grid items should not min against content size ==
Continuing from https://github.com/w3c/csswg-drafts/issues/1117 examples 1/2/5/6...

Grid is using the same "automatic minimum size" algo that Flexbox does, which sets the min to the smaller of the content size and the specified/transferred size.  This is correct for Flexbox - it gives us a reasonable minimum size that the image won't shrink below.  But it serves a different purpose in Grid, effectively setting the layout size of the *track* while the item itself sizes into that containing block, potentially overflowing it. (Or, in other words, Flexbox actually sizes the item with the information; Grid sizes the track, and then the item lays itself out, and we don't want the item to overflow its track by default.)

Therefore, in Grid it doesn't make as much sense to pay attention to the content size when a specified/transferred size exists. So, we think the right fix is to just change Grid's automatic minimum size to be the specified size if it exists, else the transferred size if it exists, else the content size.

This will make examples 1, 2, 5, and 6 all render basically the same way, with a 200px tall first row, and the image filling that row.  (Examples 3, 4, 7, and 8 rely on a different issue, so we won't worry about them here right now.) This gives more sensible results in size-constrained grids when the item's transferred size is larger than its content size, by keeping the contents of the track in sync and avoiding overlap of adjacent grid items.

Note: A similar consideration about overlapping overflow was used in [resolving issue 283](https://github.com/w3c/csswg-drafts/issues/283#issuecomment-268125974).

The proposed fix is to define the automatic minimum size for grid items inline in the spec as: the specified size if it exists, else the transferred size if it exists, else the content size.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1149 using your GitHub account

Received on Thursday, 30 March 2017 21:33:20 UTC