<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>21188</bug_id>
          
          <creation_ts>2013-03-04 15:43:39 +0000</creation_ts>
          <short_desc>Default styles should not set direction on every element</short_desc>
          <delta_ts>2013-06-10 10:58:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Aharon Lanin">aharon.lists.lanin</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>fantasai.bugs</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>public-i18n-bidi</cc>
    
    <cc>smontagu</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83941</commentid>
    <comment_count>0</comment_count>
    <who name="Aharon Lanin">aharon.lists.lanin</who>
    <bug_when>2013-03-04 15:43:39 +0000</bug_when>
    <thetext>Currently, the (normative) section on the bidi aspects of the default style sheet (http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#bidirectional-text) contains, among other items, the following:

:dir(ltr) { direction: ltr; }
:dir(rtl) { direction: rtl; }

If I understand it correctly, it assigns a value to the direction style of *every* element (since every element has a directionality, as defined in http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-directionality, and the :dir() pseudoclass works off that directionality).

This means that, in effect, the direction style will no longer be inherited, but re-set to HTML&apos;s idea of the element&apos;s directionality. Thus, if we have:

&lt;html&gt;&lt;body style=&quot;direction:rtl;&quot;&gt;&lt;p&gt;...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;

the p&apos;s direction style will be reset to ltr, the directionality that it inherits from the html element, since the setting of the direction style on the body does not affect its or its descendants directionality.

AFAIK, this is not the way that any browser works today, and if implemented will break pages that, despite various recommendations, use CSS (and not markup) to set direction.

Previous versions of this section did not set the direction style on all elements as above, but only on elements with a dir attribute. I think that this needs to be reverted.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86090</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-04-12 22:33:10 +0000</bug_when>
    <thetext>This change was made for bug 10808.

Tab: Should we use [dir]:dir(...) rather than just :dir(...), given the above ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86144</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Montagu">smontagu</who>
    <bug_when>2013-04-13 18:22:17 +0000</bug_when>
    <thetext>I also think the default style sheet is wrong here. What Mozilla currently has is (edited for clarity)

[dir=&quot;rtl&quot;] { direction: rtl; }
[dir=&quot;ltr&quot;] { direction: ltr; }
bdi:dir(ltr), [dir=&quot;auto&quot;]:dir(ltr) { direction: ltr; }
bdi:dir(rtl), [dir=&quot;auto&quot;]:dir(rtl) { direction: rtl; }

which I suppose is also not quite right since the last two lines include bdi explicit dir=&quot;ltr&quot; or dir=&quot;rtl&quot; but should not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86146</commentid>
    <comment_count>3</comment_count>
    <who name="fantasai">fantasai.bugs</who>
    <bug_when>2013-04-13 19:38:56 +0000</bug_when>
    <thetext>smontagu, wouldn&apos;t just this be sufficient?
  [dir]:dir(rtl) { direction: rtl; }
  [dir]:dir(ltr) { direction: ltr; }

It does mean that we force-set &apos;direction&apos; on elements that have invalid &apos;dir&apos; values, but I don&apos;t think that&apos;s really a problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88591</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-06-03 23:14:26 +0000</bug_when>
    <thetext>I went with comment 1 / comment 3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88592</commentid>
    <comment_count>5</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-06-03 23:16:38 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r7887.
Check-in comment: Shouldn&apos;t force-set &apos;direction&apos; on every element, only those that mention dir=&apos;&apos;.
http://html5.org/tools/web-apps-tracker?from=7886&amp;to=7887</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88605</commentid>
    <comment_count>6</comment_count>
    <who name="Aharon Lanin">aharon.lists.lanin</who>
    <bug_when>2013-06-04 06:18:13 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; I went with comment 1 / comment 3.

Simon is right in comment 2 that the way things stand, &lt;bdi&gt; got short-changed. &lt;bdi&gt; and &lt;bdi=&quot;auto&quot;&gt; are supposed to be exactly the same. However, we now set direction on &lt;bdi=&quot;auto&quot;&gt;, which is good, but do not set direction on &lt;bdi&gt;. Thus, I believe it should be:

  [dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; }
  [dir]:dir(ltr), bdi:dir(ltr) { direction: ltr; }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88872</commentid>
    <comment_count>7</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-06-06 22:15:10 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r7930.
Check-in comment: Make &lt;bdi&gt; always set &apos;direction&apos;
http://html5.org/tools/web-apps-tracker?from=7929&amp;to=7930</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>