r/css • u/EftihisLuke • Mar 03 '26
Help Anchor Positioning & popover API issue
Hey guys I am facing an issue with an implementation of a dropdown using anchor positioning and popover api. The weird this is, it only happens on mobile devices (iPhone 15 pro, tested on chrome, safari).
When closing the popover the popover seems to instantly lose its anchor placement and gets positioned the equivalent to:
top: anchor(top)
left: anchor(left)while it should be:
position-area: bottom center;
2
Upvotes
•
u/AutoModerator Mar 03 '26
To help us assist you better with your CSS questions, please consider including a live link or a CodePen/JSFiddle demo. This context makes it much easier for us to understand your issue and provide accurate solutions.
While it's not mandatory, a little extra effort in sharing your code can lead to more effective responses and a richer Q&A experience for everyone. Thank you for contributing!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/EftihisLuke Mar 03 '26
Safari does support it yes. Baseline newly available.
3
u/green__machine Mar 03 '26
It looks like it could be a bug, possibly with how anchor positioning and starting-style work together. I played around in devtools for only a few minutes but it looks like it should work. You should file a bug with WebKit.
1
u/hazily Mar 03 '26
That's just Safari being Safari TBH.
1
u/AndresBotta Mar 04 '26
This smells like a Safari/iOS bug with Anchor Positioning.
Mobile Safari is still pretty inconsistent with the Popover API and anchor positioning. When the popover closes, Safari sometimes recalculates layout before the anchor reference is stable again, so it briefly falls back to something like:
You could try:
requestAnimationFrametransform/overflowfrom parent containersSafari tends to break first when using newer CSS positioning features.
1
u/CyberWeirdo420 Mar 03 '26
Does safari even support that? Thought it was new thing and experimental
1
u/gatwell702 Mar 03 '26
There's a part where it says
position-areais more limited: https://css-irl.info/anchor-positioning-and-the-popover-api/This explains anchoring popovers is tricky: https://hidde.blog/positioning-anchored-popovers/
1
u/jamesjosephfinn Mar 26 '26
This whatwg/html GitHub issue is relevant. Also likely relevant, and mentioned in that thread, is Safari’s lack of support of the
overlayproperty.