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

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
   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
   2) forbid 'direction' propagation from body to html, fix browsers
   3) require dir=rtl propagation from body to html, fix browsers

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.
   b) Content that misplaces dir=rtl is handled, and improved because now
      the <head> is also RTL.
   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*.

   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>.

TL;DR

   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

Received on Wednesday, 11 February 2015 04:23:10 UTC