NEW 216144
[css-grid] Wrong 'auto' track size for a grid item with a specified 'width:max-content'
https://bugs.webkit.org/show_bug.cgi?id=216144
Summary [css-grid] Wrong 'auto' track size for a grid item with a specified 'width:ma...
Oriol Brufau
Reported 2020-09-03 14:40:28 PDT
Created attachment 407914 [details] testcase Originally filed by Mats Palmgren for Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=818401) **What steps will reproduce the problem?** (1) load the attached testcase **What is the expected result?** In the two tests labelled "max-content", the grid container's width and its computed 'grid-template-columns' value should be 40px, because that's the grid item's max-content size. **What happens instead?** The grid item overflows the grid container in the two tests labelled "max-content". The relevant spec section: https://drafts.csswg.org/css-grid/#algo-single-span-items "For auto minimums: If the track has an auto min track sizing function and the grid container is being sized under a min/max-content constraint, set the track’s base size to the maximum of its items’ min/max-content contributions, respectively. Otherwise, set its base size to the maximum of its items’ min-size contributions. The min-size contribution of an item is the outer size that would result from assuming the item’s min-width or min-height value (whichever matches the relevant axis) as its specified size if its specified size (width or height, whichever matches the relevant axis) is auto, or else the item’s min-content contribution." When sized under a min/max-content constraint, the base size is the item's min/max-content contributions, respectively. The item has an explicit 'width' that is 'max-content', thus it's min-content contribution is 40px and its max-content contribution is also 40px. Thus the column size is 40px which makes the container's width 40px in both cases, thus the intrinsic width of the container is 40px. Under "no constraint", the 2nd paragraph applies, and the 'min-size contribution' is "the item’s min-content contribution" (since its 'width' is not 'auto'). Again, the result is 40px.
Attachments
testcase (1.73 KB, text/html)
2020-09-03 14:40 PDT, Oriol Brufau
no flags
Radar WebKit Bug Importer
Comment 1 2020-09-10 14:41:17 PDT
Greg Whitworth
Comment 2 2022-08-23 19:52:36 PDT
This has bitten me as well as can be seen in this scenario: (1) Open https://codepen.io/gregwhitworth/pen/BarERQv Chromium and Firefox render as expected
miteshgulecha
Comment 3 2025-04-22 15:05:38 PDT
Note You need to log in before you can comment on or make changes to this bug.