-
Notifications
You must be signed in to change notification settings - Fork 757
Description
Following up on the adoption of item-flow in #11480 Unifying grid-auto-flow and flex-flow (see this WebKit blog post for an overview of item-flow), one question we need to nail down is how, exactly, the various longhand properties involved relate to each other.
(There's still open questions on what the values mean, e.g. #12803, and perhaps some of these item-* longhands will get renamed, but these are independent questions from the shorthanding mechanics, which is the focus of this issue.)
-
Option 1: Aliasing The
item-directionproperty is an alias offlex-direction, whileitem-wrapis an alias offlex-wrap, and both are longhands ofgrid-auto-flow. Masonry, as well as grid and flexbox, therefore respond to bothflex-flowandgrid-auto-flow.- This essentially collapses
flex-flowandgrid-auto-flowas a single property for cascading purposes. It simplifies the model, but there were some concerns about whether it was Web-compatible, and also whether it's confusing forflex-flowto affect grids and vice versa. item-flowwould shorthand:item-directionakaflex-direction:item-wrapakaflex-wrapitem-pack
grid-auto-flowwould aliasitem-flow, or maybe just be a shorthand ofitem-directionanditem-pack
- This essentially collapses
-
Option 2: Flex + Grid/Masonry Longhands The
item-flowproperty is a shorthand offlex-flowandgrid-auto-flow, which remain independent. Masonry layout (being a variant of “grid”) responds togrid-auto-flow.- This maintains the independence of
flex-flowandgrid-auto-flow, and avoids introducing a third property set for masonry layout by re-using thegrid-*longhands for it. item-flowwould shorthand:item-direction, itself a shorthand offlex-directionandgrid-auto-directionitem-wrap, itself a shorthand offlex-wrapandgrid-auto-wrapitem-pack, which could shorthand newflex-packandgrid-auto-packproperties if we want, but doesn't have togrid-auto-flowwould shorthandgrid-auto-directionanditem-pack(orgrid-auto-pack, if we split it out), and maybegrid-auto-wrapif we want
- This maintains the independence of
-
Option 3: Flex + Grid + Masonry Longhands The
item-flowproperty is a shorthand offlex-flow,grid-auto-flow, and a newmasonry-flowproperty, which are all independent.- This prevents
grid-auto-flowfrom affecting masonry layouts, at the cost of introducing a new parallel set of properties for controlling masonry layout. item-flowwould shorthand:
*item-direction, itself a shorthand offlex-direction,grid-auto-direction, andmasonry-directionor whatever
*item-wrap, itself a shorthand offlex-wrap,grid-auto-wrap, andmasonry-wrapor whatever
*item-pack, which could shorthand newflex-pack,grid-auto-pack, andmasonry-packproperties if we want, but doesn't have togrid-auto-flowwould shorthandgrid-auto-directionanditem-pack(orgrid-auto-pack, if we split it out), and maybegrid-auto-wrapif we want
- This prevents
The new properties outlined here are of course subject to bikeshedding, and we can customize how the shorthand values map to the longhands so the value keywords can also be bikeshedded, but these are the three fundamental approaches we could take. Which one do we want?
My preference is for option 2, fwiw. Both because I want to lean into “masonry is a variant of grid layout”, and also because Yet Another set of flow-control properties seems like overkill. :)