Skip to content

Update reset and position-anchor:auto information relating to implicit anchor association - #45550

Open
chrisdavidmills wants to merge 2 commits into
mdn:mainfrom
chrisdavidmills:fix-reset-info-anchor-positioning-popovers
Open

Update reset and position-anchor:auto information relating to implicit anchor association#45550
chrisdavidmills wants to merge 2 commits into
mdn:mainfrom
chrisdavidmills:fix-reset-info-anchor-positioning-popovers

Conversation

@chrisdavidmills

@chrisdavidmills chrisdavidmills commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

In our docs, we've included information about having to reset the default values set on popover elements, such as inset and margin property values, so that they don't break attempts to position popovers using anchor()/position-area/anchor-center.

However, as per #45515, the default behavior has been updated so that the need for these resets is avoided, except for the anchor() cases. In addition, #45514 points out that position-anchor: auto is needed to opt-in to the association, in the anchor() cases.

This PR attempts to update our information so that it is no longer out of date.

I wrote some quick demos to test the updated behavior:

Note: Another thing I noticed — even though popovers and their control buttons are meant to have implicit association, meaning that you shouldn't need to associate them with anchor-name/position-anchor, it seems like I needed to set position-anchor: auto in cases where I was doing resets to make the anchor positioning work. I was surprised by this, and I'm not 100% sure what I should say about it in the docs. This is maybe something @mfreed7 could advise me on. -- Update: I've now read the other issue and am now clear on what is going on here. I will fix both in this PR ;-)

See also mdn/dom-examples#396 for a related demo fix.

Motivation

Additional details

Related issues and pull requests

Fixes #45515
Fixes #45514

@chrisdavidmills
chrisdavidmills requested review from a team as code owners September 7, 2026 12:20
@chrisdavidmills
chrisdavidmills requested review from estelle and wbamberg and removed request for a team September 7, 2026 12:20
@github-actions github-actions Bot added Content:CSS Cascading Style Sheets docs Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@arpit-agr

Copy link
Copy Markdown
Contributor

Hi @chrisdavidmills,

On your note about needing position-anchor: auto when doing resets, I think there are two separate spec changes here and both check if position-area is none. That's what makes them look like one thing.

  1. As per §3.1, "the used value of any auto inset properties and auto margin properties resolves to 0". That's the one this PR documents.
  2. As per §2.4, the initial value of position-anchor is normal and normal behaves as none while position-area is none.
position-area Insets and margin position-anchor: normal
set (not none) auto values resolve to 0, so no resets needed behaves as auto, so implicit anchor is adopted
none popover defaults conflict, so resets are needed behaves as none, so no default anchor box

So I don't think the resets are what breaks it. With anchor() and no position-area, position-anchor behaves as none, there's no default anchor box, and anchor(top) makes the declaration invalid at computed-value time. position-anchor: auto opts it back in.

I wrote about this with the spec quotes and some suggested prose in #45514 . Happy for it to be folded in here or handled separately.

@arpit-agr

Copy link
Copy Markdown
Contributor

Sorry, I missed your update before posting. Glad it's clear now.

@chrisdavidmills chrisdavidmills changed the title Update the reset information around anchor-positioning of popovers Update reset and position-anchor:auto information relating to implicit anchor association Sep 8, 2026
@chrisdavidmills
chrisdavidmills marked this pull request as ready for review September 8, 2026 08:39
@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

Sorry, I missed your update before posting. Glad it's clear now.

@arpit-agr no worries at all — thanks for the detailed info; it saved me a lot of time.

This PR is now ready for review, and should fix both issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

3 participants