Re: [csswg-drafts] [css-anchor-position][other] Handling popover default styles (#10258)

The CSS Working Group just discussed `[css-anchor-position][other] Handling popover default styles`.

<details><summary>The full IRC log of that discussion</summary>
&lt;Rossen2> https://github.com/w3c/csswg-drafts/issues/10258#issuecomment-3099281092<br>
&lt;ydaniv> TabAtkins: dialogs and popovers in default UA stylesheet are positioned in screen-centered ways<br>
&lt;ydaniv> ... this is done by using auto margins to cause centering, it's reasonable<br>
&lt;ydaniv> ... we want popovers to be usable with anchor positioning<br>
&lt;ydaniv> ...  so ideally you should be able to set position-area and it works<br>
&lt;ydaniv> ... but default UA styles with non AP doesn't allow it<br>
&lt;ydaniv> ... has some interfernse here<br>
&lt;ydaniv> ... confuses everyone<br>
&lt;ydaniv> ... fantasai and I worked on a solution here, a new KW for this case, based on whether you're using anchor positioning or not<br>
&lt;lea> q+<br>
&lt;fantasai> To clarify: new keyword for the alignment properties<br>
&lt;fantasai> see https://github.com/w3c/csswg-drafts/issues/10258#issuecomment-3099281092<br>
&lt;ydaniv> ... if you're not centers you, and if you are using AP it acts like normal, which acts like a proper direction<br>
&lt;ydaniv> ... AFAWCT it should reproduce anchor positioning behavior correctly, and you just need to set poition-area<br>
&lt;iank_> q+<br>
&lt;ydaniv> ... masonf said it SGTM<br>
&lt;kizu> q+<br>
&lt;masonf> +1 the defaults are a footgun<br>
&lt;ydaniv> ... ntim had a concern with naming<br>
&lt;ydaniv> ... I think it's probably ok, but open to suggestions<br>
&lt;lea> lea: A margin keyword seems very overfit to me. Lots of use cases for branching styling based on whether the element is anchored or not, that cannot be done via the anchor() fallback. What about a new boolean `&lt;condition>` that can be used in `if()` and `@container`?<br>
&lt;Rossen2> ack lea<br>
&lt;ydaniv> lea: new margin KW sounds wierd to me<br>
&lt;fantasai> It's not a margin keyword<br>
&lt;ydaniv> ... we current have the function fallback but can do everything via that<br>
&lt;ydaniv> ... maybe a new bool condition in there, to tell you whether element is anchored or not<br>
&lt;ydaniv> TabAtkins:  won't work, we can't rely on outside info here<br>
&lt;ydaniv> ...  it's about whether if you're using AP or not<br>
&lt;ydaniv> fantasai: it's not a margin KW it's a KW on the alignment properties<br>
&lt;Rossen2> q<br>
&lt;ydaniv> lea: it  says why it's not a good idea, but still have concerns with overfitting<br>
&lt;ydaniv> TabAtkins: agree, let's make it work somehow, this trips everybody<br>
&lt;ydaniv> ... also think that this isn't an unreasonable for things that aren't dialog in general<br>
&lt;chrishtr> +1 to strong evidence that it's confusing a lot of people. I've heard this confusion many times now<br>
&lt;ydaniv> lea: I completely agree we need to solve this<br>
&lt;ydaniv> ... just about direction<br>
&lt;Rossen2> ack iank_<br>
&lt;miriam> q+<br>
&lt;ydaniv> iank_: I'm a little bit worried about compat here<br>
&lt;ydaniv> ... even when we first changed it to center, when we didn't have alignment KW, we ran into compat problems<br>
&lt;lea> q+<br>
&lt;ydaniv> ... it's a gut feeling this will be problematic, maybe introduce a new property?<br>
&lt;ydaniv> ... or another syntax to ignore margins?<br>
&lt;miriam> q-<br>
&lt;ydaniv> TabAtkins: trying to avoid a simple behavior switch, those are not great design<br>
&lt;ydaniv> ...  I think it might be not web compat<br>
&lt;ydaniv> ... that's the best design we've come by so far<br>
&lt;ydaniv> ... if you're not screwing with margin behavior too much this will work and preserve right behavior<br>
&lt;ydaniv> iank_: don't know<br>
&lt;ydaniv> TabAtkins: there are good and bad paths based on what you're doing<br>
&lt;ydaniv> iank_: people use dialogs in all sorts of ways<br>
&lt;ydaniv> ... worried...<br>
&lt;ydaniv> ... ppl set alignment properties, would like to try another solution<br>
&lt;ydaniv> TabAtkins:  I suspect some of directions you suggest would be just as bad<br>
&lt;ydaniv> iank_: maybe<br>
&lt;ydaniv> ... a lot of devs feel like the align properties should feel like auto margins<br>
&lt;Rossen2> ack kizu<br>
&lt;ydaniv> kizu: a few things about naming, for  popover it would be better, when you anchor it starts doing what it should<br>
&lt;ydaniv> ... q is how do we determine it? is it when there something in the insets?<br>
&lt;ydaniv> ... also think there's a second problem with try options<br>
&lt;ydaniv> ... very often you position something, you click on it and it's not there<br>
&lt;ydaniv> ... right now to replicate common libraries you need to do a lot<br>
&lt;ydaniv> ... so we should have a solution for ppl to not care about it<br>
&lt;ydaniv> TabAtkins: so naming for popover over dialog, you need to set &lt;missed><br>
&lt;ydaniv> ... you also have to reset margin auto to 0<br>
&lt;ydaniv> ... second, when you use position area<br>
&lt;ydaniv> ... we probably want to expand the definion to different things, will expand on separate issue<br>
&lt;lea> lea: I think my main issue is that this is a conditional value which hardcodes the condition and the value so they can neither be customized, nor repurposed to branch off other styles/properties. E.g. a library may want to apply different container styles for anchorless "floating" popovers vs anchored ones. If later we or authors want to vary different styles we have to pile more API surface on. Even if the condition is not around anchored vs<br>
&lt;lea> non-anchored I wonder if there might be _some_ type of `&lt;condition>` we can use. Even if the condition itself is overfit to this problem, at least that decouples it from the property and value that is being branched.<br>
&lt;ydaniv> ... also third issue, separate<br>
&lt;ydaniv> lea: if down the line we want to branch off in a different way we'll need to introduce new stuff<br>
&lt;ydaniv> ...  so wonder id my proposed condition won't work, &lt;missed><br>
&lt;ydaniv> TabAtkins: the condition we're worrying about is not whether you're using it or not<br>
&lt;iank_> (because position-area is high priority we could coerce margins to zero at that stage)<br>
&lt;ydaniv> ... we can't style based on other styles<br>
&lt;ydaniv> lea: both features work around it by  IACVT<br>
&lt;fantasai> iank_, that could maybe work... I wonder if it would be better to do that to a new margin keyword so 'auto' behaves as expected otherwise? But maybe it's not worth it.<br>
&lt;ydaniv> TabAtkins: can we move back to issue?<br>
&lt;ydaniv> Rossen2: we are at time<br>
</details>


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


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

Received on Wednesday, 30 July 2025 17:00:47 UTC