-
Notifications
You must be signed in to change notification settings - Fork 734
Description
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.