This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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's idea of the element's directionality. Thus, if we have: <html><body style="direction:rtl;"><p>...</p></body></html> the p'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.
This change was made for bug 10808. Tab: Should we use [dir]:dir(...) rather than just :dir(...), given the above ?
I also think the default style sheet is wrong here. What Mozilla currently has is (edited for clarity) [dir="rtl"] { direction: rtl; } [dir="ltr"] { direction: ltr; } bdi:dir(ltr), [dir="auto"]:dir(ltr) { direction: ltr; } bdi:dir(rtl), [dir="auto"]:dir(rtl) { direction: rtl; } which I suppose is also not quite right since the last two lines include bdi explicit dir="ltr" or dir="rtl" but should not.
smontagu, wouldn't just this be sufficient? [dir]:dir(rtl) { direction: rtl; } [dir]:dir(ltr) { direction: ltr; } It does mean that we force-set 'direction' on elements that have invalid 'dir' values, but I don't think that's really a problem.
I went with comment 1 / comment 3.
Checked in as WHATWG revision r7887. Check-in comment: Shouldn't force-set 'direction' on every element, only those that mention dir=''. http://html5.org/tools/web-apps-tracker?from=7886&to=7887
(In reply to comment #4) > I went with comment 1 / comment 3. Simon is right in comment 2 that the way things stand, <bdi> got short-changed. <bdi> and <bdi="auto"> are supposed to be exactly the same. However, we now set direction on <bdi="auto">, which is good, but do not set direction on <bdi>. Thus, I believe it should be: [dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; } [dir]:dir(ltr), bdi:dir(ltr) { direction: ltr; }
Checked in as WHATWG revision r7930. Check-in comment: Make <bdi> always set 'direction' http://html5.org/tools/web-apps-tracker?from=7929&to=7930