CSS Anchor Positioning: `position: absolute` element fails to anchor to `position: fixed` element
Categories
(Core :: Layout, defect, P3)
Tracking
()
People
(Reporter: lucacasonato, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
To reproduce:
- https://console.deno.com and create an account
- Create an organization, click on "Settings"
- Click on "Create new Environment Variable"
- Click on "Add variable"
- Click on "Contexts" dropdown
The popover is rendered at the top left of the page (see screenshot 1, from Firefox).
The popover should render under the popover trigger (see screenshot 2, from Chrome).
I can make it behave by removing the position: absolute, but I shouldn't have to do that. position: absolute with anchor-position: --... set should anchor to the anchor, not to the top left of the page.
It also works for the exact same component if it is not in a dialog.
Chrome behaves the way I expect. Firefox fails in 147, 148, and 149
I've also opened a webcompat issue: https://github.com/webcompat/web-bugs/issues/205938
| Reporter | ||
Comment 1•9 months ago
|
||
| Reporter | ||
Comment 2•9 months ago
|
||
I didn't mean to mark this as security sensitive - can someone please unmark?
Updated•9 months ago
|
Comment 3•9 months ago
|
||
Making the popover position:fixed rather than position:absolute fixes this. I'll get a reduced test case together for the issue.
Comment 4•9 months ago
•
|
||
https://random-stuff.jakearchibald.com/bug-repros/anchor-popover-absolute/ - here's a minimalish reproduction.
The issue is when the anchor-positioned element is position:absolute but anchored to a position:fixed element.
Updated•9 months ago
|
Comment 6•9 months ago
|
||
So I think this is actually a bug on Chrome/Safari side - Fixed elements parent to viewport, where absolute elements frame to the document. The implication is that the fixed element, i.e. the anchor in this case, lays out after the absolute element, i.e. the positioned element in this case, which violates the assumption required for acceptable anchor element.
In fact, with :jakea's example, making the page scroll by e.g. adding <div style="height: 200vh;"></div> to the end and scrolling, you will see that the positioned element simply scrolls away on Chrome.
Updated•9 months ago
|
Comment 7•9 months ago
|
||
I agree with your reading here :dshin.
Updated•9 months ago
|
Comment 8•8 months ago
|
||
The severity field is not set for this bug.
:boris, could you have a look please?
For more information, please visit BugBot documentation.
Updated•8 months ago
|
Updated•8 months ago
|
Description
•