-
Notifications
You must be signed in to change notification settings - Fork 708
[css-flexbox-2] Add flex-wrap: dense #3071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any progress? We need this feature. |
(Moving some comments from #11480 to the dedicated issue issue.) The Grid 3 proposal contains a #11480 proposes, as part of generalizing a few other layout properties, a new I had some feedback on the details of the slack and dense proposals for Flexbox, but it was requested that feedback be moved to a new issue. I'm copying the comments here, then I'll delete them from the original issue. Original Comment from fantasai
[re: the proposal for "dense" Flexbox behavior]
[re: the proposal for "slack" Flexbox behavior]
|
So the simple version of my alternate proposal:
I think these better reflect the current behaviors of "dense" grid packing, and "slack" masonry calculation. |
My concern is that this assumes that items can shrink the desired amount. But maybe they can't, e.g.
So I tend to think that items should still go to the next line if keeping them in the former one would cause overflow. |
I'm a bit concerned about this formulation of "dense" flexbox packing, and to-what-extent it's useful vs. weird. A few weird behaviors that I'm imagining:
Item 1 here is specific to "dense" packing in flexbox, I think. Items 2,3,4 are arguably things that already happen (or similarly-need-to-and-probably-already-are-defined) with "dense" packing in grid, though they might manifest slightly differently or more-noticeably in flexbox. |
Then they overflow. You need to make sure your specified slack actually works. You get the same issue today if you have an item that's bigger than the available space. That's almost certainly less common, of course.
The |
My point is that authors may want prefer placing an item into the current line even if it doesn't completely fit, as long as items can be squeezed together to handle it. But if not, prefer to place it on the next line. Ending up with overflow is unlikely desirable.
My concern is that they may not be able to shrink.
They may not know how much the items are able to shrink in advance.
Sure, but this is unavoidable. Here it can be avoided by only forcing into the current line if the items can handle it. |
Going further requires understanding what is meant by "able to shrink". There's a lot of possibilities! Is it min-width? min-content size? I don't think we want to cause size recomputation during line-breaking; currently we purposely just compute the base size and use that. I'd like to retain that simplicity if possible. Even if you knew how much space was "available" (say it's based on min-content sizes), the 'slack' value is still important; you probably dont' want to squeeze items in completely until the minimum size doesn't fit anymore. So the concern is, afaict, just the possibility that within your (likely relatively small) slack value, the items might be so inflexible that they can't even shrink that much. I suspect that's rarely going to be much of a problem? |
Well I think it's straightforward to define: for items with The automatic minimum sizes will typically cover min-content sizes, but that may vary. I don't know other authors, but if I can only use an extremely tiny value or otherwise I risk a high likelihood of overflow, then I won't bother using this feature, it seems useless. |
I agree with @Loirooriol, fwiw, and that was my original intention when sketching out this idea: you only cram in items if it's possible to shrink enough to fit them. |
If items don't fit on one line, try to pack them again with their min-content size instead, causing line wraps inside the item before wrapping the flex line (good for toolbars).
(copied from the wiki)
The text was updated successfully, but these errors were encountered: