W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [css-writing-modes][CSS21] propagation of 'direction' from <body>

From: Simon Pieters <simonp@opera.com>
Date: Wed, 18 Feb 2015 15:29:02 +0400
To: "Florian Rivoal" <florian@rivoal.net>, fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org, "L. David Baron" <dbaron@dbaron.org>
Message-ID: <op.xt9buoouidj3kv@simons-macbook-pro.local>
On Wed, 11 Feb 2015 08:22:27 +0400, fantasai  
<fantasai.lists@inkedblade.net> wrote:

> On 01/15/2015 07:55 AM, Florian Rivoal wrote:
>>> On 15 Jan 2015, at 09:36, Simon Pieters <simonp@opera.com> wrote:
>>> In IE/Chrome/Opera on Windows at least, the direction of the viewport  
>>> determines which side the scrollbar is. So not propagating from body  
>>> would at least flip the scrollbar to the wrong side.
>>> [...]
>>>> Florian: In general, I think we should avoid making <body> special
>>>>            unless there's compat.
>>> Agreed as a general rule, but in this case browsers have already  
>>> converged on making <body> special and there is Web content that would  
>>> be affected by not making it special (see above).
>> Given that the browser convergence is being relied on by content, I  
>> agree that propagating from <body> when the document language is html  
>> is the saner thing to do here.
> Browsers are quite inconsistent (amongst each other and within  
> themselves)
> on exactly what aspects of 'direction' propagation is actually  
> propagated.
> (Since 'direction' controls a number of different effects in CSS.)


> So we have several problems:
>    a) browsers have very inconsistent direction propagation from body to  
> html

It's really to the viewport AIUI.

>    b) some content (~0.25%) exists that depends on propagation from body  
> to html
>    c) specs (and sanity) prefer not propagating from body to html
> There are three options for what to do:
>    1) require 'direction' propagation from body to html, fix browsers

I'll take this to mean "specify the sane/consistent approach of what  
browsers do today, fix remaining bugs in browsers".

>    2) forbid 'direction' propagation from body to html, fix browsers

This is a non-option.

>    3) require dir=rtl propagation from body to html, fix browsers

See below.

> I think #3 makes the most sense because
>    a) Propagating at the HTML layer removes all of the CSS complexities,
>       making it easier to fix all the bugs and keep them fixed. Only one
>       lookup needs to happen.

Maybe it introduces other bugs instead?

>    b) Content that misplaces dir=rtl is handled, and improved because now
>       the <head> is also RTL.

This is not relevant outside test cases.

>    c) simpler model for specs and sanity
> Wrt compat concerns of only handling dir=rtl and not 'direction: rtl':
>    Greg Whitworth found on a database of 1.3 million pages only 0.03% use
>    'direction: rtl' at all. The number setting that on <body> is a subset
>    of all that, and the number setting it on <body> and not <html> and
>    relying on that making the root behave as RTL is a subset of *that*.

Did that database include external stylesheets?

In httparchive I get a different figure. Looking for pages that set  
direction: rtl or writing-mode: vertical-* on <body>, either in style="",  
or in a stylesheet:

SELECT page, COUNT(*) as num
 FROM [httparchive:runs.2014_08_15_requests_body]
ORDER BY num desc;

4222 pages out of 130k pages; ~3.25%. This is much higher than <body  
dir=rtl> (~0.25%). (The sets might be overlapping, but even if they  
overlap perfectly it still leaves ~3.00% with only direction/writing-mode.)

>    So I think it's safe to not worry about pages that (against all W3C
>    recommendations) use 'direction' on <body>, and just handle <body  
> dir=rtl>.

I disagree. The httparchive data suggests direction on body is more common  
than <body dir>. I think we should specify (1), write tests and fix bugs  
in browsers.

>    Proposal is to forbid 'direction' and 'writing-mode' propagation from  
> <body>
>    to <html> and instead require dir=rtl propagation from <body> to  
> <html>.
>    Simpler model with less potential for bugs, and solves web compat  
> issues.
> ~fantasai

Simon Pieters
Opera Software
Received on Wednesday, 18 February 2015 14:29:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:51 UTC