Extend anchor positioning support to work in CSS grid
Categories
(Core :: Layout, enhancement, P3)
Tracking
()
People
(Reporter: jwatt, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Whiteboard: [anchorpositioning:2026], [wptsync upstream])
Attachments
(5 files, 1 external file, 1 obsolete file)
There is some specific code in grid that will need some work.
Note that the effective containing block rectangle modifications due to Anchor Positioning are to be applied after any changes that grid-placement properties make to the containing block rectangle:
Updated•2 years ago
|
| Reporter | ||
Updated•1 year ago
|
| Reporter | ||
Updated•1 year ago
|
Comment 1•1 year ago
|
||
(Still need additional work to properly take this account, as demonstrated by the attached testcase)
Comment 2•1 year ago
|
||
OTOH, alignment area adjustment for grid seems to work ok with anchor positioning.
| Reporter | ||
Updated•1 year ago
|
| Reporter | ||
Updated•1 year ago
|
| Reporter | ||
Updated•1 year ago
|
| Assignee | ||
Updated•10 months ago
|
| Assignee | ||
Comment 5•10 months ago
|
||
As per https://drafts.csswg.org/css-position/#original-cb they should
happen later (and thus take priority).
Give a reasonable CB (the grid container's padding rect) down from grid
layout now that we might not use the actual grid CB.
| Assignee | ||
Comment 6•10 months ago
|
||
As per https://drafts.csswg.org/css-position/#original-cb they should
happen later (and thus take priority).
Give a reasonable CB (the grid container's padding rect) down from grid
layout now that we might not use the actual grid CB.
Remove a check for fallbacks that isn't needed since part 1 of
bug 1991929.
Comment 7•10 months ago
|
||
Updated•10 months ago
|
Comment 10•10 months ago
•
|
||
Backed out for causing wpt failures on align-self-default-overflow-htb-ltr-htb.html
Edit: Changeset relanded as the culprit is another bug.
Updated•10 months ago
|
Comment 11•10 months ago
|
||
Comment 14•10 months ago
|
||
| bugherder | ||
| Assignee | ||
Comment 16•10 months ago
|
||
Comment on attachment 9531327 [details]
Bug 1924786 - Make position-area and default-anchor adjustments take priority over CSS grid CB. r=#anchor-pos,#layout
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Fixes anchor positioning broken sites. This didn't make it before the soft-freeze because of backout.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: See blocked bugs.
- List of other uplifts needed: none
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Trivial, anchor-positioning-specific change.
- String changes made/needed: none
- Is Android affected?: Yes
| Assignee | ||
Updated•10 months ago
|
Updated•10 months ago
|
Comment 17•10 months ago
|
||
Comment on attachment 9531327 [details]
Bug 1924786 - Make position-area and default-anchor adjustments take priority over CSS grid CB. r=#anchor-pos,#layout
Approved for 147.0b2.
Updated•10 months ago
|
Comment 18•10 months ago
|
||
| uplift | ||
Updated•10 months ago
|
Comment 19•10 months ago
|
||
Hi Emilio,
Could you provide QA Android team some steps to verify this?
Thank you!
| Assignee | ||
Comment 20•10 months ago
|
||
Sure, see bug 2003745. Before this change the blue element always takes the whole space. Note that it still won't match other browsers (because of bug 1991929), but with this patch the site works better.
Comment 21•10 months ago
|
||
Verified as fixed on the Firefox for Android Nightly 148.0a1 from 12/9 using a Samsung Galaxy A56 (Android 16), following these steps"
- Navigate to: https://chrome.dev/anchor-tool/.
- Observe the "Hello, I am the positioned element!" area.
I've attached a screenshot from beta, for comparison.
Updated•10 months ago
|
Comment 22•10 months ago
|
||
Verified as fixed also on Firefox for Android Beta 147.0b2 with a Samsung Galaxy Note 8 (Android 9), and Xiaomi Poco X7 Pro (Android 15).
Comment 23•10 months ago
•
|
||
Also tested on Firefox Desktop, latest Nightly 148.0a1 and 147 Beta 2. Here are the results:
- TC 1, TC 2 and TC 3 are now correctly displayed (compared with Firefox 146RC and Chrome)
- https://anchor-tool.com/ no longer shows " Your browser does not support the CSS anchor positioning API. This tool is for demonstration purposes only. " warning, the blue element takes more space than before, and the "?" is now right under it.
Emilio, could you please take a look at the attached screenshot? Apart from the blue "Hello, I am the positioned element!" blue element, which takes more space when the browser width is not reduced (normal window), everything looks fine from QA perspective.
Thank you!
| Assignee | ||
Comment 24•10 months ago
|
||
That's expected, and covered by bug 1991929. Thanks!
Comment 25•10 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #24)
That's expected, and covered by bug 1991929. Thanks!
Thank you! Verification is now complete on Firefox 147 beta 2 and Nightly 148.0a1 across platforms.
I can confirm that latest Nightly 148.0a1 (20251211210236) contains the fix for the blue element.
Updated•8 months ago
|
Description
•