Re: [csswg-drafts] [css-display-4] Add new inner display type 'stacked' (#8321)

I generally agree with Jake here - this is just a 1x1 display:grid container.

The main objection seems to be that anonymous items will auto-flow, thus expanding the grid, so it might be useful to have a way of telling anonymous items what cell to flow into.

I don't think this makes sense in practice, tho. If multiple items stack into the same grid cell, they almost by definition obscure each other. You *need* a way to style them individually, so you can control which one is on top and visible at any given time, but you **can't** do this for anonymous items. So a stacked context with anonymous items would just be unusable, and there's no way to auto-prop your way out of that. (This includes the anonymous contents of `display:contents` items, etc.)

And if we ignore anonymous items for this use-case, then we already have all the tools we need to solve it - `display:grid; grid: 100px / 50px;` on the parent and `grid-area: 1 / 1;` on the children. You *can* go out of your way to screw this up by putting items in different cells or giving them wider spans, but there's no reason for you to do so, and we don't generally add guardrails to prevent people from messing up their page on purpose.

The one place I can still potentially see a use-case for `grid-auto-flow:stacked;` would be to ensure that if you `display:contents` an element, its *non*-anonymous children still stack properly without having to be explicitly targeted with a `grid-area` definition, but again, if they're stacked you need to be able to control which is on top, so you'll need to have targeted rules for such elements *anyway*, so asking for them to get a `grid-area` in addition to whatever else you're doing seems feasible.

So, all things considered, I think we can close this; the use-case is already solved in a short and easy manner. We could theoretically make it *slightly* shorter and easier with a custom solution, but it would be a very minor improvement, and without evidence that this use-case is common and the current solution is hampering devs, I don't think it's worthwhile adding more to CSS.

@Loirooriol, thoughts?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 19 January 2023 20:32:31 UTC