[csswg-drafts] [css-text] text-align: match-parent on the root element with direction: rtl doesn't match browsers (#6542)

zcorpan has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text] text-align: match-parent on the root element with direction: rtl doesn't match browsers ==
See this test: https://github.com/web-platform-tests/wpt/pull/30175

If I understand correctly, a used value of 'direction: rtl' on the root element is propagated to the ICB per https://drafts.csswg.org/css-writing-modes-3/#icb

Then, https://drafts.csswg.org/css-text/#valdef-text-align-match-parent says

> match-parent
> This value behaves the same as inherit (computes to its parent’s computed value) except that an inherited value of start or end is interpreted against the parent’s (or the initial containing block’s, if there is no parent) direction value and results in a computed value of either left or right. When specified on the text-align shorthand, sets both text-align-all and text-align-last to match-parent.

The initial value of text-align is 'start', so I guess the inherited value for the root element has to be 'start'. Therefore, it looks at the 'direction' of the ICB, which is propagated from the root element, and is thus 'rtl'. Therefore text-align should compute to 'right'.

Here are the results of the test:

Firefox Nightly | Safari TP | Chrome Canary
expected "right" but got "start" | expected "right" but got "left" | expected "right" but got "left"

Is my reading of the spec correct?

Should the spec be changed to side with either Firefox or Safari/Chrome?

Also, the spec only says that the computed value is "either left or right", which doesn't say which value to use. I assume a mapping where direction: ltr -> left and direction: rtl -> right, but the spec should say so explicitly.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6542 using your GitHub account

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

Received on Wednesday, 25 August 2021 13:45:21 UTC