Anchor Positioning Compat Issue: Anchored items take up the entire containing block
Categories
(Core :: Layout: Positioned, defect)
Tracking
()
People
(Reporter: bramus, Unassigned)
Details
Attachments
(3 files)
Steps to reproduce:
DEMO: https://codepen.io/bramus/pen/YPqjgMq
Actual results:
(Without the fix) this demo is behaving differently than Chrome/Safari.
To make Firefox Nightly [147.0a1 (2025-12-02) (aarch64)] behave, I needed to declare this on the .anchored elements:
width: min-content;
height: min-content;
If you remove these two declarations, the .anchored boxes take up their full containing block.
Expected results:
Given that Safari and Chrome agree no what should happen here, I think that’s what should also happen in Firefox.
Comment 1•23 hours ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Positioned' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•13 hours ago
|
||
Here's a standalone testcase, using the HTML/CSS from the codepen (without the min-content declarations that are present in the codepen to make it work in Firefox).
I can reproduce the beavior-difference in this testcase; Firefox fills the viewport with the blue labels, whereas Chrome sizes those labels to their content.
Comment 3•13 hours ago
|
||
Here's a further-reduced testcase.
In Firefox, the anchor-positioned auto-sized element with bottom span-right extends to the bottom and right edge of the viewport; in Chrome, it shrinks-to-fit its contents.
Comment 4•13 hours ago
|
||
This reference case demonstrates that if I give the element an explicit size, then it doesn't stretch, as bramus observed in comment 0.
Comment 5•13 hours ago
|
||
jwatt or dshin, could you take a look?
(Tentatively triaging as S3; but depending on the anticipated impact, we might want to consider it S2, and aim to fix before anchor makes it to release.)
Comment 6•13 hours ago
|
||
It's bug 1991929. Intended behaviour should be equivalent to:
width: fit-content;
height: fit-content;
Or, more indirectly,
align-self: start;
justify-self: start;
Description
•