Re: [csswg-drafts] [css-grid-2] subgrid border/padding/margin

The Working Group just discussed `CSS Grid`, and agreed to the following:

* `RESOLVED: The MBP of the subgrid plus the items in the first column that contains items are attached together to create a fake item which spans those columns in order to reserve space for the subgrid‘s MBP.`
* `RESOLVED: Keep the rule in the spec which treats subgrid as an empty item which spans all of its spanned tracks, in addition`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: CSS Grid<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/2592<br>
&lt;fantasai> fantasai: This is about handling margins/borders/padding of the subgrid itself<br>
&lt;myles> ScribeNick: myles<br>
&lt;myles> fantasai: The previous rule we had didn’t work if your sub grid had some empty columns and things. We wanted to fix it. 2 solutions, i’ts about how strictly you tie the BPM to the outermost column when the columns are missing on the edges.<br>
&lt;myles> TabAtkins: Our current approach: the sub grid and its items are laid out in the parent grid independently but we take the sub grids MBP and apply the sum of their widths as magical extra margin on the appropriate edges of sub grid items that are in the first or last tracks<br>
&lt;myles> TabAtkins: So that they position themselves naturally as if they were inside the sub grid<br>
&lt;myles> fantasai: That also takes into account the grid itself. The problem is when there is no item on the side, we can attach the extra BPM to the item, then it takes the space.<br>
&lt;myles> fantasai: Then everything collapses away<br>
&lt;myles> fantasai: There are two approaches we have: 1) Strictly account for the margins and borders and padding in the track of the sub grid edge so even if the track is empty then we have a fake item that has the MBP fo the subgid attached to it.<br>
&lt;myles> fantasai: IT reserves space for the MBP and requires the MBP to be in this specific colum<br>
&lt;myles> fantasai: 2) Make sure the combination of tracks from the last track with an item in it has enough space for th MBP fo the subgrid<br>
&lt;myles> fantasai: Let’s say the subgrid has a really thick border. You could do *draws picture*. But in the other approach we would have to bump out the column to make it wider to fit the MBP. And then this track would be fully empty and we’ve got our item here<br>
&lt;myles> fantasai: The question: Do we want to use the tracks other than the last track to accommodate the MPB or do we want to force the MBP to be on the outer most track<br>
&lt;myles> Rossen: We discussed internally. Our idea: the one where MBP of the subgrid is accounted for in addition to whatever the items are in the first and last columns of the span of the subgrid. In other words, the subgrid acts as an item itself that spans all of the other items and the only thing that contributes is its MBP<br>
&lt;myles> fantasai: That was the original model, and it doesn’t work because if you treat it as an empty thing which spans all of them, then the MBP, like let’s say we have 2 items, the MBP could be handled, to be treated as a spanning item, so we could have MPB here and here, and we don’t’ have enough space<br>
&lt;myles> Rossen: When I said spanning, that was poorly chosen. I meant like a grid item spanning.<br>
&lt;myles> fantasai: We are treating MPB as an item. The spec said that MBP was an item wherever it ended up, but that doesn’t work if there are empty columns. Two alternatives: 1) Treat the MBP as being a grid item in the very last column only, or treat it as a grid item in all of the empty columns up until the last item<br>
&lt;frremy> q+<br>
&lt;myles> florian: In most use cases, you don’t have thick MBP, so most of the time the two will be the same<br>
&lt;myles> florian: But some time it might be and then solution 2i s nicer but more complicated<br>
&lt;myles> Fantasai: it’s not more difficult<br>
&lt;astearns> ack frremy<br>
&lt;Rossen> ack frremy<br>
&lt;myles> frremy: Optino 1 is not a good option because if the first one has as size of 5 pax and the border is 1 pax, you don’t want the track to change the size fo the grid overall.<br>
&lt;myles> frremy: I implemented just like Rossen said<br>
&lt;myles> Fantasai: If it’s a fixed size, you overflow, whoever, that’s your fault<br>
&lt;myles> frremy: But in the example, you still want the remaining 10 pix you can’t fit in the first one to fit<br>
&lt;myles> frremy: So i did exactly what Rossen mentioned, the grid was doing a layout itself with the layout fo the inner item.<br>
&lt;myles> frremy: In think you never end up in the case where the column is too small<br>
&lt;myles> Fantasai: the question we need to resolve is whether MBP can intrude into a column that is not the last column it spans<br>
&lt;myles> Rossen: agree<br>
&lt;myles> Rossen: What do people think?<br>
&lt;myles> TabAtkins: *head nod*<br>
&lt;myles> Rossen: Proposal: The sub grid will afford for its MBP by contributing its MBP to either the last column if it happens to be auto, or any other auto column of the main grid.<br>
&lt;myles> Fantasai: That’s way more complicated. Because then you can say, let’s say all the columns are auto, then this subgrid could fit within, if we allow it to intrude into this column which is empty int he subgrid, then the MBP could be accommodated without changing the size fo the column. But if we did what you said, then teh column would have to be pushed out.<br>
&lt;myles> Rossen: right<br>
&lt;myles> Rossen: This is slightly more complex.<br>
&lt;myles> Fantasai: The proposal in the issue is the MBP of the subgrid has to be accommodated int eh subgrid after the item it appears in<br>
&lt;myles> Rossen: This is the first option, right?<br>
&lt;myles> Fantasai: yes<br>
&lt;frremy> frremy: this means you account for the mbp independently on the four sides<br>
&lt;frremy> fantasai: yes<br>
&lt;myles> Rossen: Minimally account for the MBP by making sure that the combination of tracks from teh last track with an item in it to the edge fo teh subgrid has enough space to accomodate the subgrid‘ s MBP<br>
&lt;myles> Rossen: That is a worthy resolution, but this is the proposed resolution<br>
&lt;myles> florian: Clarification, what if there are multiple empty tracks, and all of them are auto, and the sum is too small, which do you grow?<br>
&lt;myles> Fantasai: You attach it to the last time.<br>
&lt;myles> S/time/item/<br>
&lt;myles> frremy: In the case where all the columns except the last one are fixed size .... so you do each side and the total<br>
&lt;myles> Fantasai: So you have a subgrid in the middle, and the subgrid is who knows well and this item is in here and we have a lot of columns. When we try to do all the sizing, the subgrid si going to contribute its items for sizing. This one does not get MBP attached because it’s’ not on the edge. But then we need to account for sub grid’s MBP, so we take this item, and we attach to this edge the MBP of<br>
&lt;myles>  this subgrid item and treat this as an item which spans from this column to the edge of the subgrid<br>
&lt;myles> frremy: So we will still do a big one with all of the subrgrid<br>
&lt;myles> frremy: because if all the columns before are fixed size, you still may want to increase the middl ecolumn<br>
&lt;myles> Fantasai: But this guy can’t move, This item can’t leak into this column. So this column has to accomodate the item and the subgrid’ s MBP.<br>
&lt;myles> Fantasai: *draws on whiteboard*<br>
&lt;myles> frremy: *draws on whiteboard*<br>
&lt;Rossen> Example on the board: https://lists.w3.org/Archives/Public/www-archive/2018Jul/0004.html<br>
&lt;myles> Fantasai: The left side MBP can’t be accommodated here, and it will end up overflowing.<br>
&lt;myles> frremy: The way I wrote it, would be this would be there.<br>
&lt;myles> Fantasai: The content edge of the subgrid cannot be further to the right of the margin edge of the item.<br>
&lt;myles> frremy: But i fyou have 0 items, you have different behavior than if you have 1 item<br>
&lt;myles> Fantasai: but that’s the point. The item has to say in teh column in which its assigned. It can’t move<br>
&lt;myles> frremy: I would prefer it overflows the subgrid<br>
&lt;myles> frremy: The subgrid fits, but the item overflows.<br>
&lt;myles> frremy: I would do left side right side up side down side (hokey pokey)<br>
&lt;myles> Fantasai: I think that’s weird<br>
&lt;myles> frremy: but it’s better because it’s consistent<br>
&lt;myles> frremy: Most cases will do the same thing, its’ fine. your track will not change size when you add an item.<br>
&lt;myles> Fantasai: I see your argument, but I still think it’s super weird<br>
&lt;myles> Rossen: but the case you’re describing is weird<br>
&lt;myles> Fantasai: frremy: *repeats the arguments*<br>
&lt;myles> Fantasai: okay fine<br>
&lt;myles> Fantasai: we’ll figure it out<br>
&lt;myles> Rossen: Let’s capture this in a resolution<br>
&lt;myles> Fantasai: The case we’re talking about is when all the tracks of the subgrid from the edge of the subgrid all the way through and including the first track with an item are fixed size, and a track on the other side of the item is auto sized, then if the MBP of the subgrid is too big to fit within the fixed set of tracks, then it will cause an increase int eh size of the auto tracks anywhere on teh<br>
&lt;myles>  other side, and will thus paint underneath the item and into that auto track rather than being attached to the outside fo the item and overflowing to the left<br>
&lt;myles> florian: so if that doesn’t fit there, but it fits there, you go underneath, but you don’t increase the size. But if you have to go beyond, then you increase the size to fit it there<br>
&lt;myles> Fantasai: that seems okay.<br>
&lt;myles> Rossen: This is more or less what I was suggesting<br>
&lt;myles> frremy: If you have a border you want the border not to be included int eh column of the item. The border should be outside.<br>
&lt;myles> Fantasai: That’s great, let’s’ resolve<br>
&lt;myles> Fantasai: We need 2 resolutions.<br>
&lt;myles> Fantasai: Proposed resolution: The MBP of the subgrid plus the items in the first column that contains items are attached together to create a fake item which spans those columns in order to reserve space for the subgrid‘s MBP.<br>
&lt;myles> Rossen: Did anyone follow tha tproposed resolution? Any objections?<br>
&lt;florian> +1<br>
&lt;myles> 10:38 myles: Fantasai: Proposed resolution: The MBP of the subgrid plus the items in the first column that contains items are attached together to create a fake item which spans those columns in order to reserve space for the subgrid‘s MBP.<br>
&lt;myles> RESOLVED: The MBP of the subgrid plus the items in the first column that contains items are attached together to create a fake item which spans those columns in order to reserve space for the subgrid‘s MBP.<br>
&lt;myles> fantasai: In addition, to accomodate the situations where the columns of the above item are all fixed, we do a calculation which allows that MBP to bleed through the first column with all the items in it and potentially expand an auto column on the other side<br>
&lt;myles> frremy: Proposal: Keep what’s in teh spec and add teh previosu resolution. Don’t replace what’s int he spec.<br>
&lt;myles> Fantasai: Cool<br>
&lt;Rossen> s/teh/the/<br>
&lt;myles> Fantasai: Resolution: Keep the rule in the spec which treats subgrid as an empty item which spans all of its spanned tracks<br>
&lt;Rossen> additional subgrid example: https://lists.w3.org/Archives/Public/www-archive/2018Jul/0005.html<br>
&lt;myles> Fantasai: Resolution: Keep the rule in the spec which treats subgrid as an empty item which spans all of its spanned tracks, in addition<br>
&lt;myles> Rossen: Any objections?<br>
&lt;myles> &lt;silence><br>
&lt;myles> RESOLVED: Keep the rule in the spec which treats subgrid as an empty item which spans all of its spanned tracks, in addition<br>
&lt;emilio> ScribeNick: emilio<br>
</details>


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

Received on Thursday, 5 July 2018 01:05:16 UTC