W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2017

Re: [csswg-drafts] [css-grid] auto-placement of item named with grid-area, but without a corresponding placement in grid-template-areas

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Thu, 02 Feb 2017 18:33:45 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-277042153-1486060424-sysbot+gh@w3.org>
This doesn't have anything to do with auto-placement - all the items 
are explicitly placed, after all.  This is about line names.

When you say `grid-area: c;`, that expands to `grid-row-start: 
c-start; grid-row-end: c-end; grid-column-start: c-start; 
grid-column-end: c-end;`.  None of these named lines exist in the grid
 - the only named lines are `a-start`, `a-end`, `b-start`, and `b-end`
 (all implicitly created by `grid-template`) in each axis. However, 
lines in the implicit grid have all possible names, so the line-search
 ends up finding the first implicit line in each axis for all the 
properties.  Grid areas aren't allowed to span zero tracks, so the end
 line gets pushed out by one, to the second implicit line.

Thus, the C item starts on line 3 (the first implicit line) and ends 
on line 4 in each axis, leaving one empty track around the edge of the
 implicit grid (between lines 2 and 3).  You don't see the empty 
column, because it's "auto" sized and collapses to 0 size, but the 
empty row is 100px high due to `grid-auto-rows`.

A D item with `grid-area: d` gets put in the exact same place, for the
 same reason.

This behavior is intentional. It's an error case, whose behavior falls
 out of the generic behavior we purposely defined for finding 
non-existent line names.  We're not interested in making this case act
 "better", because failing obviously and in a slightly weird way makes
 it more likely the author will see that something's wrong and will 
fix it.

If you really feel like calling out a case like this would help, 
@rachelandrew, feel free to draw up an example.  But it's definitely 
an error case and will stay that way. ^_^

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/966#issuecomment-277042153 
using your GitHub account
Received on Thursday, 2 February 2017 18:34:07 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:30:28 UTC