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

Re: [css-writing-modes][CSS21] propagation of 'direction' from <body> (was Re: [CSSWG] Minutes Telecon 2014-07-09)

From: Simon Pieters <simonp@opera.com>
Date: Thu, 15 Jan 2015 09:36:16 +0100
To: www-style@w3.org, "L. David Baron" <dbaron@dbaron.org>
Message-ID: <op.xshwuqytidj3kv@simons-mbp>
On Mon, 01 Dec 2014 13:47:04 +0100, Simon Pieters <simonp@opera.com> wrote:

> It seems to me that the current situation is that implementors are  
> converging towards interoperably propagating direction and writing-mode  
>  from body.
>
> https://codereview.chromium.org/758073003
>
> AFAIK, nobody has done research on the Web compat impact of following  
> the spec. Is anyone interested in doing the research and implementing  
> the spec? If not, I think we should change the spec to match what is  
> implemented.


On Thu, 15 Jan 2015 02:57:22 +0100, Dael Jackson <daelcss@gmail.com> wrote:

> 'direction' propagation from <body>
> -----------------------------------
>  - There was some concerns about the implications of this change,
>        but due to the limited amount of time remaining on the call,
>        nothing was resolved or decided.

--  
<http://www.w3.org/mid/CADhPm3sQak6gwgVDJspSLbf8Du59QU55jUQRjanG=PrhqCQmqQ@mail.gmail.com>


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.


In http://webdevdata.org/ data set 2015-01-08, 87,000 pages (not including  
subresources in e.g. iframes):

$ find . -type f -print0 | xargs -0 -P 4 -n 40 grep -Eoi  
"<body\s[^>]*dir\s*=\s*[\"']?rtl[^>]*>" >> ../body-dir-rtl.txt

118 occurrences of <body dir=rtl>. (0.13%)


In httparchive 2014-08-15 300,000 pages  
https://www.igvita.com/2013/06/20/http-archive-bigquery-web-performance-answers/  
(including subresources but counting top-level pages):

SELECT page, COUNT(*) as num FROM  
[httparchive:runs.2014_08_15_requests_body]
WHERE mimeType = "text/html"
AND REGEXP_MATCH(LOWER(body), r"<body\s[^>]*dir\s*=\s*[\"']?rtl")
GROUP BY page
ORDER BY num desc;

755 pages with <body dir=rtl>. (0.25%)


SELECT page, COUNT(*) as num FROM  
[httparchive:runs.2014_08_15_requests_body]
WHERE mimeType = "text/html"
AND REGEXP_MATCH(LOWER(body), r"<body\s[^>]*dir\s*=\s*[\"']?rtl")
AND NOT REGEXP_MATCH(LOWER(body), r"<html\s[^>]*dir\s*=\s*[\"']?rtl")
GROUP BY page
ORDER BY num desc;

710 pages with <body dir=rtl> and not <html dir=rtl>. (0.24%)


Further replying to the minutes of the last telecon:

On Thu, 15 Jan 2015 02:57:22 +0100, Dael Jackson <daelcss@gmail.com> wrote:

> 'direction' propagation from <body>
> -----------------------------------
>  zcorpan: It seems that browsers are propagating 'direction' and
>            'writing-mode' always from <body>, even if it's set on
>            root element as well.
>   <zcorpan> https://codereview.chromium.org/758073003
>   zcorpan: So we should just specify the implemented reality.
>   <zcorpan> probably
>  fantasai: I wonder what happens when you make the <head> visible?
>   fantasai: Does it use the <body> direction/writing-mode?
>   dbaron: Gecko does different things in different places. There are
>           2 or 3 places in our code where we care about the
>           direction on the root, and they're inconsistent with each
>           other.
>   <zcorpan>  
> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3366
> - visible head, dir on body
>  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).

>   fantasai: I want to keep writing-mode consistent with direction.

My proposal is to make both propagate from body.

>   fantasai: I don't *mind* making them inconsistent, but...
>   fantasai: I think the important one to consider here is direction.
>   <zcorpan> in blink direction and writing-mode are consistent with
>             each other i think
>   <dbaron> for Gecko doing different things, see
>            https://bugzilla.mozilla.org/show_bug.cgi?id=1071098#c16

If I understand correctly, you want to align Gecko more with IE and  
Chrome, and also that the initial scroll position should be consistent  
with direction/writing mode. That makes sense to me.

>  tantek: Does it affect the title element?
>   TabAtkins: Yes, the one on the page. I'm unsure what happens in
>              the browser tab.
>   TabAtkins: In Chrome, <title> in the tab doesn't pay attention to
>              rtl.
>  fantasai: What is the percentage of pages that have dir=rtl on the
>             body and not on html tag?

See above.

>   Rossen: You can have the same thing specified with properties.
>   fantasai: Yeah, but it's rare and bad practice.

-- 
Simon Pieters
Opera Software
Received on Thursday, 15 January 2015 08:34:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:27 UTC