Re: unicode-bidi: plaintext alignment of all-neutral paragraphs in CSS

Sorry that it has taken me so long to answer.

> another concern was the divergence of the base directionality wrt bidi
reordering vs the base directionality for alignment.

Let me handle this one first.

Such divergence is not optimal, but it is actually quite common, being the
least of all evils. I am referring to setting text-align to left (not
start) in an LTR page (and right in an RTL page) on a field whose direction
is opposite to that of the page, in order to get the overall layout of the
page to work well. This is usually the best thing to do for fields
whose content is significantly shorter than the field's width. It is
definitely the wrong thing to do for fields whose content is longer than
the field's width and is allowed to wrap, since wrapped content is
definitely less readable when it is aligned to its end side. Ah, so what
does one do when one doesn't know whether the field's content will be short
or wrapped? There is a neat trick: put the content in an element with
direction set to the content's directionality, text-align:start, and
layout:inline-block. Then wrap that element in another whose text-align
matches that of the page and whose width is as desired. The outcome is that
short content appears aligned to the page's start (and thus to its own
end), while wrapped content appears aligned to its own start, and everyone
is happy.

Unfortunately, this trick does not work for a field that contains multiple
paragraphs of content (wrapped when longer than the field's width) whose
directionality may not match that of the page or even one another. The
canonical solution for such fields is unicode-bidi:plaintext, and it is for
these fields that I made my suggestion. In such fields, one generally wants
RTL paragraphs to be aligned right, and LTR paragraphs to be aligned left,
since each may be wrapped. However, it is better for the all-neutral LTR
paragraphs to match the alignment of their surroundings. Yes, that means
that their alignment may not match their directionality, but as I explained
above, this is not unusual and is probably the least of all evils.

> one concern was inconsistency in handling all-neutral content before and
after a strong paragraph

It is easier to talk about specific examples. Koji gave one in a private

[start of example]
> Arabic

Then the first stand-alone  ">" goes one way, while the second stand-alone
">" goes the other way.
[end of example]

My take on this example is that I don't have a big problem with that
outcome, given that the > on the line with the Arabic on it will be < and
right-aligned too. In fact, I am not even sure that the current way comes
out better. Generally speaking, nothing is going to be perfect, but I think
that my proposal will fix more problems than it creates.

> particularly at the start of the plaintext block

We can tweak the proposal to look at the paragraph(s) after the all-neutral
one if there are no non-neutral paragraphs before it (or consider other
tweaks or even entirely different proposals, if there are any).

Received on Sunday, 5 July 2020 11:15:46 UTC