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

[csswg-drafts] [css-grid2] API for querying implicit grids

From: MarkUK via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 May 2017 11:41:26 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-231316668-1495712485-sysbot+gh@w3.org>
MarkUK has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid2] API for querying implicit grids ==
When using an implicit grid with automatically placed items, there seems to be no way to query the item to identify where it finally ended up, in row and column terms. Similarly it would be useful to be able to query the number of rows and columns in the grid, or get the bounding rect for a particular "cell".

Using `getComputedStyle()`, for example, _does_ return useful values for `grid-template-columns`, but  simply returns "auto" for `grid-column-start` and `grid-row-start` on an item in the grid.

A complementary API to get the element(s) at a particular row/column position would also be useful.

**Use case:** I have a UI layout that automatically places widgets in a grid to maximise the use of the available space. As a convenience I would like my users to be able to move vertically from field to field using the up/down cursor keys. To do this I need to find out the grid position of the current field, and then identify which field is in the cell directly above/below it.

There are, I'm sure, indirect ways to deal with this using `getBoundingClientRect()` or similar, but they are convoluted and fragile compared to being able to ask the grid to report information about itself.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1465 using your GitHub account
Received on Thursday, 25 May 2017 11:41:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:54 UTC