Discussion:
[css-logical-props] self vs ancestor. (Wrong solution ?)
(too old to reply)
Peter Moulder
2016-11-08 20:26:34 UTC
Permalink
Raw Message
Consider the following document:

<body>
horizontal parent
<div style="writing-mode:vertical-rl; float:inline-end">
vertical float
</div>
<body>

According to the current spec, float:inline-end here means float:bottom.
Which doesn't make sense here, because it participates in a horizontal BFC.

To serve their intended purpose in this example, logical directions for
'float' would need to be defined wrt some box guaranteed to have the same
'writing-mode' dimension as the BFC in which the float participates, such
as the containing block. Similarly for 'clear'. (Whereas logical
directions for 'text-align' need to continue to be defined wrt self, for
similar reasons.)

However, once one does that, how does one add a margin between the float
and the shortened line boxes? The obvious answer would be:

margin-inline-start: 1em

until one realizes that here again, we want "inline-start" to be
interpreted relative to the same box as used for 'float', rather
than relative to itself.

Indeed, it seems like containing block would be the right choice for
most uses of logical margin properties.

Cf the approach described in css-writing-modes:

# [...] calculating the width and height of the box [...] are performed
# accordingly using the writing mode of the box [...]
#
# [...] calculating the positioning offsets, margins, borders, and
# padding [...] are performed according to the writing mode of the
# containing block of the box [...]

That would certainly be one model to consider copying when deciding which
properties mentioned in css-logical-props should be defined according to
self and which go by containing block. (It's certainly not the only option
to consider, and I'd be concerned that this one would do the wrong thing
for padding in particular.)

However, I'm concerned that merely making a choice for each property as to
whether logical directions refer to self or containing block would leave us
with some degree of unpredictabilitity to authors, and/or that there would
be significant use cases that would want a different choice of referent
from what we choose. I lack authoring experience; what do others think?

pjrm.
fantasai
2017-06-20 20:37:54 UTC
Permalink
Raw Message
Post by Peter Moulder
<body>
horizontal parent
<div style="writing-mode:vertical-rl; float:inline-end">
vertical float
</div>
<body>
According to the current spec, float:inline-end here means float:bottom.
Which doesn't make sense here, because it participates in a horizontal BFC.
To serve their intended purpose in this example, logical directions for
'float' would need to be defined wrt some box guaranteed to have the same
'writing-mode' dimension as the BFC in which the float participates, such
as the containing block. Similarly for 'clear'. (Whereas logical
directions for 'text-align' need to continue to be defined wrt self, for
similar reasons.)
However, once one does that, how does one add a margin between the float
margin-inline-start: 1em
until one realizes that here again, we want "inline-start" to be
interpreted relative to the same box as used for 'float', rather
than relative to itself.
Indeed, it seems like containing block would be the right choice for
most uses of logical margin properties.
# [...] calculating the width and height of the box [...] are performed
# accordingly using the writing mode of the box [...]
#
# [...] calculating the positioning offsets, margins, borders, and
# padding [...] are performed according to the writing mode of the
# containing block of the box [...]
That would certainly be one model to consider copying when deciding which
properties mentioned in css-logical-props should be defined according to
self and which go by containing block. (It's certainly not the only option
to consider, and I'd be concerned that this one would do the wrong thing
for padding in particular.)
However, I'm concerned that merely making a choice for each property as to
whether logical directions refer to self or containing block would leave us
with some degree of unpredictabilitity to authors, and/or that there would
be significant use cases that would want a different choice of referent
from what we choose. I lack authoring experience; what do others think?
This was discussed in two threads:
https://lists.w3.org/Archives/Public/www-style/2015Jan/0576.html
and
https://lists.w3.org/Archives/Public/www-style/2016May/0098.html
and resolved in:
https://lists.w3.org/Archives/Public/www-style/2016Jun/0019.html

In short, the concerns you raise about the containing block being
a more appropriate reference are 100% valid; however for the sake
of having a simple, understandable rule and because the existing
behavior of list items follows this interpretation, the WG resolved
to use the element’s own writing mode.

(It is not an ideal solution, but one doesn't really exist given the
conflicting constraints.)

~fantasai

Loading...