Re: [csswg-drafts] [css-grid] Intrinsic contributions for items spanning flex tracks are not web compatible (#4783)

The CSS Working Group just discussed `Intrinsic contributions for items spanning flex tracks are not web compatible`, and agreed to the following:

* `RESOLVED: The auto minimum size is zero for grid items that span multiple tracks when at least one of those tracks is flexible.`
* `RESOLVED: When destributing the intrinsic contribution of a grid item, if it spans flexible tracks, excess size is distributed to those tracks and not to fixed/auto sized tracks.`

<details><summary>The full IRC log of that discussion</summary>
&lt;AmeliaBR> Topic: Intrinsic contributions for items spanning flex tracks are not web compatible<br>
&lt;AmeliaBR> github: https://github.com/w3c/csswg-drafts/issues/4783#issuecomment-587749012<br>
&lt;AmeliaBR> oriol: This is a web incompatibility issue.<br>
&lt;AmeliaBR> ... In the last published version of spec, we weren't taking into account intrinsic contributions of items that span multiple tracks, if one of those tracks was flexible.<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/4783<br>
&lt;AmeliaBR> ... This doesn't doesn't make much sense. So we changed in E.D., but when I tried to implement the change I had to revert because it wasn't web compatible.<br>
&lt;AmeliaBR> ... My proposal is to alter the draft to keep as much of the new behavior as possible, but still be web compatible.<br>
&lt;AmeliaBR> ... But I found 2 different problems. There's a common pattern of 12 columns sized with 1fr. The intention is that all columns equal sized &amp; not overflow. But problem is that 1fr by default has `auto` min size, which takes intrinsic size into count.<br>
&lt;AmeliaBR> ... right now, you don't see the auto min because most items span multi-columns. If we changed that so the intrinsic has an effect, you could make columns uneven or even overflow container.<br>
&lt;AmeliaBR> ... Now, this is partly an author error. You'd get the overflow if you had items that didn't span multiple columns. Could use minmax to make it work, but since 1fr was working, authors didn't do that.<br>
&lt;AmeliaBR> ... So suggestion is that the auto min width of elements is zero if they span multiple tracks, at least one track is flexible.<br>
&lt;AmeliaBR> ... Then in the algorithm, we'd change the auto min width, but the rest would work out based on that.<br>
&lt;AmeliaBR> ... But if someone explicitly said `min-content` for minimum width, that would work correctly.<br>
&lt;fantasai> +1 to Oriol's proposal<br>
&lt;AmeliaBR> ... I think this would handle most web compat issues.<br>
&lt;AmeliaBR> ... There's an example with code &amp; images in the issue.<br>
&lt;AmeliaBR> jensimmons: So, right now this is about making things easier for authors? They *can* do what they want either way, but this is about making the default better?<br>
&lt;AmeliaBR> oriol: Right now in browsers, you can't use min-content or max-content for these items. It always behaves as zero. So the proposal is to support that. It's what the current draft was trying to do, but the change addresses the compat. Going back to always being zero isn't very useful.<br>
&lt;AmeliaBR> fantasai: FWIW, tab &amp; I support the proposal.<br>
&lt;AmeliaBR> oriol: Should I cover the other issue, or resolve on this.<br>
&lt;AmeliaBR> PROPOSAL: The auto minimum size is zero for grid items that span multiple tracks when at least one of those tracks is flexible.<br>
&lt;AmeliaBR> astearns: Are there any concerns about having a switch based on spanning multiple tracks.<br>
&lt;AmeliaBR> fantasai: I think that's better than the alternative.<br>
&lt;AmeliaBR> ... The published draft already has a switch based on spanning multiple tracks. It means we don't consider intrinsic sizes at all. The existing change to the ED got rid of that, but it's not compatible by default.<br>
&lt;AmeliaBR> ... Oriol's proposal is that by default you get the current behavior, but if you specify something explicit that is used instead.<br>
&lt;fremy> fwiw, now that understand the difference between current and proposed, I support this change<br>
&lt;AmeliaBR> ... So yes, we have an inconsistency about whether the intrinsic size is considered, based on spanning multiple tracks. But we're shifting the inconsistency from the grid algorithm to the definition of auto min size.<br>
&lt;AmeliaBR> Rossen: But we're still having an inconsistency in auto min size. The default behavior isn't do the right thing.<br>
&lt;AmeliaBR> fantasai: Yes, but it's do what authors currently expect because of current implementations.<br>
&lt;AmeliaBR> Rossen: Is compat that bad?<br>
&lt;AmeliaBR> fantasai: Yes.<br>
&lt;AmeliaBR> Rossen: OK, so I guess this is least worst solution.<br>
&lt;AmeliaBR> RESOLVED: The auto minimum size is zero for grid items that span multiple tracks when at least one of those tracks is flexible.<br>
&lt;AmeliaBR> oriol: OK, the second problem affected authors who knew about the problem of using auto minimum in a flexible track, so they used an explicit minimum of zero, which then causes a separate problem.<br>
&lt;AmeliaBR> ... If you have 2 columns, one sized with minmax, other with 1fr. One item in auto column only, the other item crosses both.<br>
&lt;AmeliaBR> ... Author expects the flex item to fit the item that's only in that column, but we resolved in 3075 that *all* the flexible tracks, if they don't have an intrinsic minimum, it would be spread across all the tracks that an item spans.<br>
&lt;AmeliaBR> ... Otherwise, a minimum size on a particular item could cause it to overflow.<br>
&lt;AmeliaBR> ... But generally the element spanning both columns is the larger one, so this can result in stretching the column &amp; therefore the other item too much.<br>
&lt;AmeliaBR> ... This could have been fixed with the content keywords, but since setting a minimum of zero was formerly a good way to do this, that's what they used.<br>
&lt;AmeliaBR> ... Proposal is to modify resolution from 3075. If an item spans flexible tracks, when running track-sizing algorithm, the intrinsic contribution will only be distributed among the *flexible* tracks it spans, not the non-flexible ones.<br>
&lt;AmeliaBR> ... That would solve this use case. There wouldn't be too much contribution going to the auto column, all the extra would go to the flexible one.<br>
&lt;AmeliaBR> ... It would still cover the use case we were trying to solve in the previous issue.<br>
&lt;fantasai> s/It/The resolution we just took/<br>
&lt;AmeliaBR> astearns: We never resolved that other issue.<br>
&lt;AmeliaBR> fantasai: But the resolution we just had would address it, with this one modification.<br>
&lt;AmeliaBR> fantasai: I think there are some subtleties to define in what we mean by flexible tracks taking up this extra size. E.g., depends on whether it has a fixed or intrinsic minimum size, and whether we're sizing the grid under a min size constraint.<br>
&lt;AmeliaBR> oriol: Should we do this at all if sizing under a min/max content constraint?<br>
&lt;AmeliaBR> fantasai: In that situation, we always consider the contents. That's expected. But I think we still have some errors there were we consider the min or the max but not both. So we do need to think about those details.<br>
&lt;fantasai> https://drafts.csswg.org/css-grid-1/#algo-flex-tracks<br>
&lt;fantasai> s/the min or the max but not both/the max, but not the min/<br>
&lt;AmeliaBR> fremy: My impression  of this topic is that we had something widely implemented that we didn't think was well designed, but now we're making piecemeal changes to try to fix compatibility. But I'm afraid we're going to get inconsistent implementation where some browsers make some of these changes but not others. Reminds me of CSS tables, in a bad way. We're going to need careful tests to make sure we have consistency.<br>
&lt;AmeliaBR> TabAtkins: Elika &amp; I have been adding tests as we go, so we should catch that quickly.<br>
&lt;fantasai> s/as we go/against the changes section/<br>
&lt;AmeliaBR> fantasai: And we can add tests for these changes in next couple weeks.<br>
&lt;AmeliaBR> astearns: So, you have no concerns about these particular changes, just about following up with tests?<br>
&lt;AmeliaBR> fremy: Yes.<br>
&lt;AmeliaBR> astearns: fantasai, the other issue you raised about the algorithm not handling min/ max content, that's a separate issue?<br>
&lt;AmeliaBR> fantasai: yes, we can still go ahead with this.<br>
&lt;AmeliaBR> oriol: PROPOSAL: When destributing the intrinsic contribution of a grid item, if it spans flexible tracks, excess size is distributed to those items and not to fixed/auto sized tracks.<br>
&lt;AmeliaBR> Rossen_: {Gives an example}<br>
&lt;AmeliaBR> oriol: No. If there are fixed size tracks, that size is subtracted before distributing extra to the flexible tracks.<br>
&lt;AmeliaBR> Rossen_: OK, then I agree. Need to make that clear.<br>
&lt;AmeliaBR> RESOLVED: When destributing the intrinsic contribution of a grid item, if it spans flexible tracks, excess size is distributed to those tracks and not to fixed/auto sized tracks.<br>
&lt;AmeliaBR> astearns: ... and add tests<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4783#issuecomment-664627235 using your GitHub account

Received on Monday, 27 July 2020 20:41:35 UTC