Closed Bug 1990901 Opened 2 months ago Closed 2 months ago

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)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1924786

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.

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.

(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.)

Depends on: 1924786
Severity: -- → S3

Queued for triage, ni? to investigate to see if it should just be a dupe.

Flags: needinfo?(dshin)
Whiteboard: [anchorpositioning:triage]

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).

Status: NEW → RESOLVED
Closed: 2 months ago
Duplicate of bug: 1924786
Flags: needinfo?(dshin)
Resolution: --- → DUPLICATE
Whiteboard: [anchorpositioning:triage]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: