Re: [csswg-drafts] [css-grid] Property "grid-item-of": display any element as part of any given grid (#2530)

> I think this idea is likely to raise major accessibility concerns. The ability to reorder content within a single grid can already cause problems. This suggestion says we should be able to take any item from any grid (or perhaps even from outside all grids) and place it into any other grid. The potential for completely destroying the usefulness of the markup seems rather high.

Note that displaying an element as part of any given grid was the initial intention of this issue.
Reordering elements visually always has the risk to break the usefulness of the markup and the UX, and that applies to all solutions we can come up here. Though one main reason for allowing to visually place elements somewhere in the layout structure is to *improve* the markup by getting rid of unnecessary container elements or even whole DOM structures of duplicate content.

> For example:
> 
> ```
> #container {
>      display: grid[my-grid];
> }
> 
> #element {
>      grid-column: [my-grid] 2 / 3;
> }
> ```

As far as I can see, this is not much different to my more general proposal with the difference that it restricts the repositioning to grid layouts.

But this approach has a big downside. It forces to use a specific display type in order to reposition the elements. This will potentially be abused by authors which will declare an element to be a grid just in order to be able to lay out an element as an item of it. So, in the end authors can achieve the same effect like in the more general idea but in a rather hacky way.

Also, from your example it is not clear but from your concern about the markup I guess you meant that `#element` *must* be a descendant of `#container`.
And the discussion of whether the elements must be descendants of the elements they will be layed out in or not is independant of the syntaxes presented here, be it one restricted to grids or my more general approach with `child-of`.

Sebastian

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

Received on Saturday, 7 March 2020 11:18:24 UTC