Re: [csswg-drafts] [css-align-3][css-flexbox-1] How to determine the last baseline of a flex container with different alignment groups. (#7641)

The CSS Working Group just discussed `How to determine the last baseline of a flex container with different alignment groups.`, and agreed to the following:

* `RESOLVED: when taking the baseline of a row of item, we check a shared first baseline, then a shared last baseline, then the first baseline of the first item`

<details><summary>The full IRC log of that discussion</summary>
&lt;Rossen_> Topic: How to determine the last baseline of a flex container with different alignment groups.<br>
&lt;Rossen_> github: https://github.com/w3c/csswg-drafts/issues/7660<br>
&lt;fremy> iank_: blink would like to implement last-baseline alignment<br>
&lt;fremy> iank_: (by blink I mean me)<br>
&lt;fremy> iank_: but how do we find out what is the last baseline is a question<br>
&lt;fremy> iank_: currently, anything that uses a baseline alignment should be counted in<br>
&lt;fremy> iank_: if none are, you fallback<br>
&lt;fremy> iank_: there are groups however<br>
&lt;fremy> iank_: some might be first-baseline aligned, some might be last-baseline aglined, etc...<br>
&lt;fremy> iank_: how do you choose? it's the question<br>
&lt;fremy> iank_: maybe TabAtkins can elaborate<br>
&lt;fremy> TabAtkins: I'm projecting the example on the screen<br>
&lt;fremy> fantasai: if we consider a flex container with multiple elements with baseline alignment<br>
&lt;fremy> fantasai: we want the baseline of these elements<br>
&lt;fremy> fantasai: but if you have last-baseline alignment only<br>
&lt;Rossen_> q?<br>
&lt;fremy> fantasai: should that count as the first baseline of that group?<br>
&lt;fremy> fantasai: or should we bail out?<br>
&lt;fremy> fantasai: and if you have both types of alignment in the first row<br>
&lt;fremy> fantasai: these might not align with each other<br>
&lt;fremy> fantasai: how do you pick in that case?<br>
&lt;fremy> dbaron: I would like to propose something<br>
&lt;dholbert> FWIW firefox's rendering changes when I inspect in devtools, so we've clearly got a bug here :)<br>
&lt;fremy> dbaron: maybe the solution is that if you look for a first baseline, first-baseline-aligned things should be used first<br>
&lt;fremy> dbaron: and vice versa for last baseline<br>
&lt;fremy> iank_: yes, I think most people agree with that<br>
&lt;Rossen_> ack dbaron<br>
&lt;fremy> iank_: an issue is what you do next<br>
&lt;fremy> fantasai: if a page has a navigation bar<br>
&lt;fremy> fantasai: and it's last-baseline aligned<br>
&lt;heycam> q+<br>
&lt;fremy> fantasai: if most items have one line, but one has two<br>
&lt;fremy> fantasai: if I align something with this, what behavior do we want?<br>
&lt;fremy> fantasai: we can either use the last-baseline that every item aligns to<br>
&lt;fremy> fantasai: or the first baseline of each of these items<br>
&lt;fremy> fantasai: I would posit that the shared baseline is a better guess for what the author might want<br>
&lt;fremy> iank_: to repeat that<br>
&lt;fremy> iank_: if we are trying to find the last baseline<br>
&lt;dbaron> I think what fantasai said seems reasonable as long as when there are *two* shared baselines, we pick the one being exported.<br>
&lt;chrishtr> Note: discussion not recorded to issue 7387 yet..<br>
&lt;fremy> iank_: we would pick the first baseline as the last baseline if that's all we got<br>
&lt;fremy> iank_: and if we don't even have that, then we fallback to the last baseline of the bottom item<br>
&lt;dholbert> q+<br>
&lt;fremy> fantasai: yes<br>
&lt;fremy> iank_: reasonable<br>
&lt;fremy> heycam: would not exporting a baseline be reasonaoble?<br>
&lt;fremy> fantasai: we will always do that<br>
&lt;Rossen_> ack heycam<br>
&lt;fremy> fantasai: but right now we synthetize one<br>
&lt;fremy> fantasai: that is rarely desirable<br>
&lt;fremy> heycam: isn't that enough?<br>
&lt;fremy> fantasai: it's better to use the other baseline, for the author<br>
&lt;fremy> iank_: the final fallback could be the first or last item<br>
&lt;fremy> iank_: I agree that the middle step is ok<br>
&lt;fremy> dholbert: I'm not sure we don't always the fallback<br>
&lt;dbaron> github: https://github.com/w3c/csswg-drafts/issues/7641<br>
&lt;fremy> dholbert: I'm worried that we could get a weird telescope effect<br>
&lt;heycam> s/telescope/stair-step/<br>
&lt;fremy> dholbert: things will be lined up<br>
&lt;fremy> dholbert: but in opposite directions<br>
&lt;fremy> dholbert: which might not look good, actually<br>
&lt;fremy> dholbert: the synthetic is at least "logical"<br>
&lt;fremy> fantasai: iank_ proposed to use the lower last baseline and the hightest first baseline etc...<br>
&lt;fremy> fantasai: but if you have five items that are 1, 2 or 3 lines tall; whether or not your item is at the top or the bottom, it won't look very reasonaoble<br>
&lt;fremy> fantasai: if you align with the shared baseline, the alignment will look reasonable I think<br>
&lt;fremy> dholbert: but if you are looking for a first baseline and there is none<br>
&lt;Rossen_> q?<br>
&lt;fremy> dholbert: I don't understand why the special handling is gonna make things substantially better<br>
&lt;fremy> fantasai: if you are aligning one line of text, it's more sensible<br>
&lt;Rossen_> ack dbaron<br>
&lt;Rossen_> ack dholbert<br>
&lt;fantasai> if you're asking for baseline alignment, you want to align to text, not to fall back to a box edge, if possible<br>
&lt;fremy> iank_: my comment is that if you are trying to find the last baseline, you could get the lowest in the first row<br>
&lt;fremy> iank_: this is kinda how tables work<br>
&lt;fremy> iank_: but the two solutions I most like<br>
&lt;fremy> iank_: is either use the first baseline item then use the fallback<br>
&lt;fremy> iank_: or fantasai's solution where there is a middle step<br>
&lt;fremy> iank_: both solutions look reasonable<br>
&lt;fremy> Rossen_: and if you had to pick?<br>
&lt;fremy> iank_: no strong opinion<br>
&lt;fremy> iank_: the first one is a bit simpler to implement because its has two levels only<br>
&lt;fremy> fantasai: if we are looking into multi-rows grid to align<br>
&lt;fremy> fantasai: if you don't have the middle step, you will get worse results<br>
&lt;florian> q+<br>
&lt;fremy> fantasai: because fewer things will align with each other<br>
&lt;dholbert> q+<br>
&lt;Rossen_> ack florian<br>
&lt;fremy> florian: flex items contain text<br>
&lt;fremy> florian: so it makes sense for them to have both<br>
&lt;fremy> florian: but the container only has one line<br>
&lt;dholbert> no, flex containers can have last-baseline as well as first-baseline aligned items<br>
&lt;dholbert> and can export both<br>
&lt;dholbert> (I think)<br>
&lt;fremy> florian: so I can't think of of any other relevant baseline is than the shared baseline<br>
&lt;fremy> iank_: you can look into it in two ways<br>
&lt;fremy> iank_: the question is that the fallback approach<br>
&lt;fremy> fantasai: in the issue, iank_ suggested also to look for the lowest or highest across all items<br>
&lt;fremy> fantasai: this would give even better results<br>
&lt;fremy> iank_: yes, this is another option I would accept<br>
&lt;fremy> iank_: I'm just worried a bit about the compat risk<br>
&lt;Rossen_> ack dholbert<br>
&lt;fremy> dholbert: when finding the first/last baseline, would what you described be the canonical algorithm?<br>
&lt;fremy> iank_: yes<br>
&lt;fremy> dholbert: then I would worry about compat too, I think<br>
&lt;fremy> dholbert: for the grid case, I agree that in most cases what fantasai proposes makes more sense<br>
&lt;fremy> dholbert: but when you have one flexbox with one item, which is a common case, which would be confusing I think<br>
&lt;fremy> dholbert: we could find the baseline of that first item<br>
&lt;fremy> iank_: it's an edge case<br>
&lt;fremy> iank_: you can get the correct behavior by doing nothing<br>
&lt;fremy> iank_: so, why would you do it if that's not what you want?<br>
&lt;fremy> iank_: I'm thus not very concerned<br>
&lt;Rossen_> ack dbaron<br>
&lt;fremy> dbaron: after listening to fantasai's explanation, I'm reasonably convinced that we want the fallback levels<br>
&lt;fremy> dbaron: because some things might need to be changed later in the design<br>
&lt;fremy> dbaron: otherwise, if you change things in one place, you have to change consistently, which might be difficult<br>
&lt;fremy> dbaron: the middle step enables to change only locally, and get things to work anyway<br>
&lt;fremy> iank_: seems like most people are aligning with fantasai's solution<br>
&lt;fremy> iank_: anyone would object to that?<br>
&lt;fremy> Rossen_: sounds like you will have to do the more complex implementation :)<br>
&lt;fremy> iank_: yes...<br>
&lt;fremy> Rossen_: ok, any objection?<br>
&lt;fremy> fantasai: proposed resolution: when taking the baseline of a row of item, we check a shared first baseline, then a shared last baseline, then the first baseline of the first item<br>
&lt;florian> +1<br>
&lt;fremy> fantasai: (everywhere we can get away with it without compat issues)<br>
&lt;dbaron> s/taking the baseline of a row of item/taking the first baseline of a row of items/<br>
&lt;fremy> iank_: the only additional warning is that you can have a first-baseline aligned thing in the first-baseline group, but that seems fine<br>
&lt;dbaron> (and vice-versa for the last baseline)<br>
&lt;fremy> Rossen_: ok, no objection,<br>
&lt;fremy> RESOLVED: when taking the baseline of a row of item, we check a shared first baseline, then a shared last baseline, then the first baseline of the first item<br>
</details>


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


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

Received on Thursday, 15 September 2022 19:22:53 UTC