Anchor-positioned elements are placed at wrong location in a grid, if their anchor element is anywhere besides the grid top-left corner
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: dholbert, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(4 files)
Spinning this off for some reduced versions of this WPT:
https://wpt.live/css/css-anchor-position/anchor-position-grid-001.html
That full WPT -- which we currently fail -- uses anchor-and-grid-in-a-multicol, but we also get the wrong result if you remove the multicol wrapper.)
I think we've got an issue with placing the anchor-positioned elements whenever the anchor element is anywhere other than the top-left corner of the grid. It looks like we apply the anchor element's offset-from-its-parent twice when establishing the positions for its anchor-positioned friends, for some reason.
| Reporter | ||
Comment 1•2 months ago
|
||
| Reporter | ||
Comment 2•2 months ago
|
||
| Reporter | ||
Comment 3•2 months ago
|
||
| Reporter | ||
Comment 4•2 months ago
|
||
Here's a testcase that I was expecting might be broken, but this one works correctly.
As with the rest, the anchor element is at x=50 y=20 within the grid container, in this case because its grid cell is large (150px-by-120px) and the anchor element is smaller (100px-by-100px) and end-aligned within that cell (align-self: end;justify-self: end;).
For whatever reason, we get things correct in this case; we draw the lime anchor-positioned "borders" at the proper location around the anchor element, covering up the red borders.
The expectation here is that all four testcases should render identically (like we currently render this one), with the anchor positioning pref enabled.
| Reporter | ||
Comment 5•2 months ago
|
||
(looks like bug 1924786 is already tracking some pieces that are known-to-not-work-yet in CSS grid, so this is probably a version of that bug. Maybe/hopefully the testcases here will all work properly when that bug is fixed. --> adding dependency.)
| Reporter | ||
Updated•2 months ago
|
Comment 6•2 months ago
|
||
Queued for triage, ni? to investigate to see if it should just be a dupe.
Comment 7•2 months ago
•
|
||
Right, this is bug 1924786 comment 1 - we don't handle cases where absolute containing block size shrinks to the grid via grid-column and grid-row (EDIT: To confirm - removing these properties off of anchor positioned elements renders as expected).
Updated•2 months ago
|
Description
•