Re: [css-align][css-grid] which position to use for aligning a baseline-aligned subtree of grid items?

On 05/17/2016 06:40 PM, Mats Palmgren wrote:
> On 2016-05-18 00:46, fantasai wrote:
>> On 05/14/2016 08:16 AM, Mats Palmgren wrote:
>>> https://drafts.csswg.org/css-align-3/#align-by-baseline
>>> "Position this aligned subtree
>>> within the alignment container according to the rules of the box
>>> alignment properties in effect."
>>>
>>> It's rather vague what "alignment properties in effect" you're
>>> referring to here.  When aligning grid items the alignment
>>> container is a track, which doesn't have any properties per se.
>>
>> I think what this is referring to is the fallback alignment
>> https://drafts.csswg.org/css-align-3/#baseline
>>  # If the alignment subject’s position is not fully determined
>>  # by baseline alignment, the content is start-aligned insofar
>>  # as possible while preserving the baseline alignment. (Content
>>  # that has no first baselines is thus start-aligned.
>
> Hmm, are you sure?  I read the above as a fallback when the alignment
> subject doesn't have a baseline in the given axis, which isn't
> the case here.

No, the "not fully determined" bit is definitely talking about
when the baseline-alignment doesn't fully constrain its position
within the alignment container.

> What I've implemented now is aligning the baseline subtree to
> the start when the grid container [align|justify]-content is
> 'start', 'stretch', etc, and aligning it to the end for 'end'
> (ditto for the other <content-position> values to whatever side
> they correspond to, except 'center').
>
> For 'center' and <content-distribution> I align the baseline
> subtree to the center of the track, growing it as needed.

As you pointed out, these things are kindof operating on different
things, i.e. items within a track vs. tracks within a grid.

Not opposed to doing it this way if people think it makes sense,
though. I'll run it by the WG.

> Only being able to align first-baseline-aligned subtrees to the start
> of the track (and last-baseline to the end) seems a bit primitive.
> It's fairly trivial to align both to either the start/end/center so
> it might be worth adding a property specifically for this so that
> authors can choose where they want it.

If we did that, we'd add another keyword to the same property,
similar to how the <content-distribution> values are handled.

I suppose if you want to implement it, we could easily add it to
the spec. :) The main argument for leaving it out was to make less
work for you!!

>>> In general, all the spec sections on baseline alignment would
>>> benefit from illustrations to make your intent clearer.
>>
>> Yeah... Agreed on that point. :(
>
> I understand that drawing illustrations takes time and may not be
> a priority, but please consider drawing something quick on a whiteboard
> and taking a photo as a temporary solution (as I've seen in some drafts).

Yeah, it's been on my mind to do that. Just haven't got the chance
to sit down with a sketchbook and absorb myself in drawing pictures.
Baseline alignment desperately needs it, as you point out!

Maybe once we've got all the severely-backlogged specs updated. :)
Grid, Flexbox, Alignment, Values, Text, Inline, Scroll Snap, and a
few others are all overdue for an update. I could maybe do that
during the Last Call period for Grid.

~fantasai

Received on Wednesday, 18 May 2016 02:16:06 UTC