Re: [csswg-drafts] [css-anchor-position-1] `position-fallback-bounds` vs `position-container` (#9868)

The CSS Working Group just discussed ``[css-anchor-position-1] `position-fallback-bounds` vs `position-container` ``, and agreed to the following:

* `RESOLVED: Replace position-fallback-bounds with a more generic solution that addresses positioning and not just overflow checks`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> TabAtkins: right now we have `position-fallback-bounds`. Was added via feedback from una, where she noted that an abspos has a regular cb, but for top layer is a bit unfortunate, because it loses the ability to position itself relative to the previous containing-block<br>
&lt;emilio> ... so `position-fallback-bounds` added another set of clipping to the rectangle<br>
&lt;emilio> ... fantasai wanted a more generic some functionality<br>
&lt;emilio> s/some //<br>
&lt;emilio> ... or for top-layer, select any containing block<br>
&lt;iank_> q+<br>
&lt;emilio> ... so fantasai proposed switching to a more generic `position-container` and use that as your containing block modulo restrictions to prevent layout order issues<br>
&lt;emilio> fantasai: so previously `position-fallback-bounds` is added because if your cb is the whole page you might want to check a smaller region of the page<br>
&lt;bramus> q+<br>
&lt;emilio> q+<br>
&lt;emilio> ... so my proposal is to drop position-fallback-bounds and just let you choose the containing-block<br>
&lt;florian> q+<br>
&lt;emilio> ... so when you use position-container, then that becomes the containing block for all purposes<br>
&lt;emilio> chrishtr: so a generic way of overriding the containing block<br>
&lt;astearns> ack iank_<br>
&lt;emilio> iank_: few things, how do you select the containing-block?<br>
&lt;emilio> ... what names it?<br>
&lt;emilio> TabAtkins: wanted to use the anchor-name property as well<br>
&lt;emilio> iank_: so it's the anchor's containing block<br>
&lt;emilio> TabAtkins: no, the element itself<br>
&lt;emilio> iank_: you don't want the containing-block to be an anchor<br>
&lt;emilio> TabAtkins: not the anchor you're using for position, just an element with a different anchor-name<br>
&lt;emilio> iank_: I'd prefer a new property for this<br>
&lt;astearns> [Tab draws]<br>
&lt;emilio> TabAtkins: fine with that [draws in whiteboard]<br>
&lt;emilio> TabAtkins: the element should probably be a relpos so it establishes a containing block etc<br>
&lt;emilio> iank_: you need to select containing blocks that are ancestors of the real containing-block?<br>
&lt;emilio> TabAtkins: yes<br>
&lt;bramus> q-<br>
&lt;emilio> iank_: you need to consider how this interacts with containment<br>
&lt;dholbert> [Tab's drawing showing a containing block rectangle, with an anchor element inside of it. Both of those elements have a defined anchor-name. The tooltip uses a anchor-default to attach to an anchor, vs. position-container to choose its CB, in both cases using the anchor-name that's defined for those boxes]<br>
&lt;emilio> ... it'd potentially defeat containment optimizations<br>
&lt;emilio> TabAtkins: maybe? We don't care about containment for anchors<br>
&lt;emilio> iank_: we do<br>
&lt;emilio> TabAtkins: same deal then<br>
&lt;emilio> iank_: how does this work with grid and such magical containing blocks?<br>
&lt;emilio> TabAtkins: want to explicitly define that<br>
&lt;emilio> ... if the named containing block satisfies the rules for an area of it it should still work<br>
&lt;emilio> iank_: I think I'd prefer not to do that<br>
&lt;astearns> q+<br>
&lt;emilio> TabAtkins: we try to capture: if you started as an abspos, and move to the top layer, you shouldn't lose the ability of positioning relative to your previous containing block<br>
&lt;emilio> iank_: tbd on this issues<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> scribe+<br>
&lt;fantasai> emilio: Similar concerns. Part of the reasons people move to top layer is to lose being restricted to that containing block, so if you put the element back into that containing block, how does that interact with clipping etc?<br>
&lt;fantasai> emilio: or is this just about containing block area and rules for positioning<br>
&lt;fantasai> TabAtkins: I think this is just about CB area. We can also discuss being able to clip things in certain ways<br>
&lt;fantasai> TabAtkins: but for now I think this should be focused on the area that you have<br>
&lt;fantasai> emilio: so affects the rules for positioning<br>
&lt;una> q+<br>
&lt;astearns> q--<br>
&lt;fantasai> emilio: you'd override the CB rect to be someone else's rect<br>
&lt;fantasai> fantasai: I think that's what it would do, yes<br>
&lt;fantasai> emilio: ok, that seems less magical than I was afraid<br>
&lt;fantasai> emilio: that solves a lot of the interactions wrt e.g. "what is the offset parent"<br>
&lt;dholbert> q+<br>
&lt;fantasai> chrishtr: so it causes something else to be the container for abspos descendants?<br>
&lt;fantasai> TabAtkins: No, it changes what your containing block rect is<br>
&lt;fantasai> emilio: if you're a top-layer thing, and you select a CB with this property<br>
&lt;fantasai> emilio:  your contianing block is still the viewport, just the rect that you position against can be an in-flow child<br>
&lt;fantasai> chrishtr: so constraint rect for the anchor positioning feature would be some other element<br>
&lt;astearns> q-<br>
&lt;fantasai> TabAtkins: Say your nearest CB ('positoin: relative' ancestor) is a scroller<br>
&lt;fantasai> TabAtkins: you want to escape scroller, so you use toplayer<br>
&lt;fantasai> TabAtkins: but you want to be positioned within the bounds of the scroller<br>
&lt;fantasai> TabAtkins: now you can use position-container: --scroller; and you will resolve top/left/bottom/right against the scrolelr's rectangle<br>
&lt;fantasai> TabAtkins: doesn't necessarily adopt that scroller's clip<br>
&lt;fantasai> emilio: is the fallback stuff bound to that rectangle?<br>
&lt;fantasai> emilio: there are use cases for both<br>
&lt;dholbert> scribe+<br>
&lt;dholbert> fantasai (IRC): a lot of the cases where you're not positioning you'd solve with anchor positioning<br>
&lt;dholbert> fantasai (IRC): maybe you're trying to anchor something that's not a scroller, maybe in a sidebar or something<br>
&lt;dholbert> fantasai (IRC): if you overflow the bounds of the sidebar, you fall back to a different position<br>
&lt;dholbert> fantasai (IRC): if there's an element somewhere else in the DOM but you want to position it in the sidebar<br>
&lt;dholbert> emilio (IRC): what if sidebar is larger than viewport<br>
&lt;dholbert> fantasai (IRC): if you're abspos, that's fine, you don't care about it<br>
&lt;dholbert> fantasai (IRC): if you're fixed-pos, you intersect the rects<br>
&lt;dholbert> iank_ (IRC): this only works on fixed things plus top-layer things<br>
&lt;dholbert> TabAtkins (IRC): that's indeed the condition<br>
&lt;dholbert> iank_ (IRC): this won't let you go higher for an abspos<br>
&lt;astearns> ack florian<br>
&lt;dholbert> emilio (IRC): will work for abspos with top layer<br>
&lt;emilio> florian: not entirely sure I understand this but let's assume I do<br>
&lt;emilio> ... kind of annoying to have to name all the things<br>
&lt;emilio> ... the other thing is the target needs to be a valid container<br>
&lt;emilio> ... presumably you walk up the tree after you find that?<br>
&lt;emilio> ... but you could target the bar in your example and it'd walk up<br>
&lt;emilio> TabAtkins: a keyword for "your usual cb" might be convenient<br>
&lt;emilio> ... still subject to all the rules<br>
&lt;emilio> q+<br>
&lt;fantasai> emilio: There's no reason you need to be an abspos containing block<br>
&lt;fantasai> emilio: just need a rect that you can reference<br>
&lt;fantasai> TabAtkins: Yeah, any valid anchor<br>
&lt;astearns> ack una<br>
&lt;fantasai> emilio: as long as you're in that containing block chain<br>
&lt;fantasai> una: I want to ask, does this solve the use cases. I think it does. I like being more generic.<br>
&lt;emilio> una: I wanna answer some of the questions, does it solve some of the fallback bounds?<br>
&lt;emilio> ... I think this solves the use case of having a popover that behaves like a non-popover<br>
&lt;astearns> ack dholbert<br>
&lt;emilio> ... if this is possible I'd like this more generic approach over the fallback bounds<br>
&lt;florian> s/presumably you walk up the tree after you find that/presumably you walk up the tree if the named target isn't a valid container?<br>
&lt;dbaron> [current state of whiteboard is PXL_20240213_200933096.jpg , from a few minutes ago]<br>
&lt;emilio> dholbert: the feature as presented seems like something I might use in the absence of top layer to attach to a different ancestor CB<br>
&lt;astearns> +1 to dholbert (this was what I was on the queue for earlier)<br>
&lt;emilio> ... and if I have an intermediate scroller that'd clip my abspos<br>
&lt;emilio> q+<br>
&lt;emilio> TabAtkins: if you're a normal abspos and there is an intervening scroller that wouldn't be a valid anchor<br>
&lt;emilio> ... it'd need to be below your containing block<br>
&lt;una> having a generic `position-container` (if possible) does include the use cases of `position-fallback-bounds` for anchored popovers and looks like it will solve additional use cases<br>
&lt;emilio> ... because that element is not guaranteed to be laid out<br>
&lt;emilio> dholbert: so the restrictions is the same for valid anchors?<br>
&lt;emilio> TabAtkins: yes<br>
&lt;emilio> dholbert: I think then the name overloading with anchor-name makes sense<br>
&lt;emilio> chrishtr: I think we should not name this container because it's not a containing block, it's a sort of constraining-element<br>
&lt;astearns> ack emilio<br>
&lt;astearns> emilio: was going to bring up the naming stuff<br>
&lt;dholbert> emilio (IRC): I was gonna bring up the naming stuff; since after all, you're not overriding the CB, you're just choosing a different rect to be constrained by<br>
&lt;dholbert> emilio (IRC): and that's fine; +1 to taking naming to the issue<br>
&lt;dholbert> emilio (IRC): maybe we can resolve on this thing, not changing the CB but changing the rect we're relative to<br>
&lt;dholbert> fantasai (IRC): I'm not sure I'm clear on all the stuff discussed, maybe we can take it to the issue<br>
&lt;dholbert> fantasai (IRC): maybe we can resolve on dropping position-fallback-bounds for now, in favor of this thing to be discussed<br>
&lt;dholbert> chrishtr (IRC): in favor of element-based solution?<br>
&lt;astearns> proposed resolution: replace position-fallback-bounds with a more generic solution that addressed positioning and not just overflow checks<br>
&lt;dholbert> fantasai (IRC): a more generic solution , that also affects positioning<br>
&lt;dholbert> TabAtkins (IRC): that lets you swap between your fallbacks based on a different rect. want to let your insets, top/left/bottom/right, be relative to this thing as well<br>
&lt;emilio> https://github.com/w3c/csswg-drafts/issues/9904<br>
&lt;dholbert> emilio (IRC): want to bring up a tangential issue that I filed about top-layer CB, just linked in minutes<br>
&lt;dholbert> emilio (IRC): I think abspsos CB for top layer...there are some things we want to be clear, you may want to choose between inner rect vs. outer rect, i.e. with/without scrollbars<br>
&lt;dholbert> emilio (IRC): +1 to dropping fallback-bounds, +1 to going this direction (of a generic element-defined rect approach)<br>
&lt;dholbert> fantasai (IRC): una and I can work with tab and others to create a proposal<br>
&lt;dholbert> emilio (IRC): there may be use cases for ... I'm in the top layer, but my containing-block rect doesn't need to be constrained by scrollbars. maybe another keyword for this<br>
&lt;astearns> proposed resolution: Replace position-fallback-bounds with a more generic solution that addresses positioning and not just overflow checks<br>
&lt;astearns> RESOLVED: Replace position-fallback-bounds with a more generic solution that addresses positioning and not just overflow checks<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9868#issuecomment-1942383523 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 13 February 2024 20:18:16 UTC