-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction between Popover API and CSS Anchor Positioning specs #9311
Comments
Is there an 8th scenario where |
I made all of the cases into a jsfiddle here: https://jsfiddle.net/jarhar/301cmbqo/ It looks like anchor positioning and anchorElement is only enabled when the anchor attribute is set, which goes against your scenarios 2, 3, 5, and 7. |
Right now there's no such thing as " It will also look a bit broken to me if any popover attr implicitly sets It's possible that we make popovers somehow have an implicit anchor element (eg invoker); that's going to be a different story though And auto anchor positioning (
There's no CSS setting the |
Right, so I can understand not having Also in the 1-n scenario (1 popover and n invokers), this would also save me from having to write javascript to set the |
I agree with the comments above that we shouldn't mix the invoker and the anchor. It's possible that we could decide to make the invoking element an "implicit anchor element" but there's a separate question about whether we need to expose that implicit anchor element as a Javascript property. Note that in all of your imperative examples in the OP, you can use |
As your questions have been answered, and the suggestion of automatically making the invoker an anchor is being handled here, I'm going to close this issue |
So I've been reading efforts on popover and CSS Anchor positioning. Based on my understanding, i wrote out some scenarios on how I think this will/should work. This includes imperative & declarative ways to show a popover.
If this is how it will work based on current specs, then great, consider this a thought exercise :) If not, please point out where I've gone wrong and we can discuss that.
1. Imperative popover without invoker
No
anchorElement
oranchor
attribute is set. The popover is centered in the viewport because there is no CSS anchor positioning styling.2. Imperative popover with invoker
This references #9111 for the
invoker
parameter.Implicitly sets the
anchorElement
to the button, based on theinvoker
parameter totogglePopover
. The popover is centered in the viewport because there is no CSS anchor positioning styling.3. Declarative popover without
anchor
attributeImplicitly sets the
anchorElement
property to the button. The popover is centered in the viewport because there is no CSS anchor positioning styling.4. Declarative popover with
anchor
attributeThe
anchor
attribute causesanchorElement
to be set on the popover. The popover is centered in the viewport because there is no CSS anchor positioning styling.5. Declarative popover without
anchor
attribute and CSS anchor positioning stylingThe
anchorElement
is set implicitly on the popover and has the value of the button element. Based on theanchorElement
, the button automatically becomes theimplicit
anchor element of the popover (see https://drafts.csswg.org/css-anchor-position-1/#anchor-pos). The popover is positioned relative to the button because of the CSS anchor positioning styling.6. Declarative popover with
anchor
attribute and CSS anchor positioning stylingThe
anchor
attribute causes theanchorElement
property to be set on the popover and has the value of thediv#other
element. Based on theanchorElement
, thediv#other
element automatically becomes theimplicit
anchor element of the popover. The popover is positioned relative todiv#other
because of the CSS anchor positioning styling.7. Declarative popover with CSS anchor positioning styling
anchor-element
overrideThe
anchor
attribute causes theanchorElement
property to be set on the popover and has the value of thediv#decoy
element. Because the popover has an explicit anchor element specified in theanchor()
function, the popover is positioned relative todiv#other
.The text was updated successfully, but these errors were encountered: