Re: Proposal for new direction attribute

Amir E. Aharoni, Thu, 21 Feb 2013 00:07:50 +0530:
> i2013/2/20 Phillips, Addison:

>> In my opinion, using the @lang attribute to set direction is a
>> bad idea. The language tag is not an explicit indicator of the
>> direction of content. It may, of course, imply the direction.
>> But it is a poor indicator compared to either explicit
>> direction or to first strong (auto direction).
  ...
> There are edge cases, the most famous examples being Punjabi and
> Azeri, but as I explain in
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=19888 , using correct
> language codes solves this problem. Developers should use a correct
> lang attribute anyway. This also means that "few people use the lang
> attribute" is a weak argument.
> 
> What I am proposing is to apply a *default* direction according to the
> specified language, and to make it possible to override with an
> explicit dir (or direction) attribute.

 FIRST: Like fantasai, I am sceptic towards minting an entirely new
        attribute. I like Amir’s idea, as it, with some 
        modifications that I propose, could allow us to not
        introduce any new attributes or attribute values.

SECOND: I propose a variation on Amir’s proposal: 
        <div lang="he" dir="auto">isolation rtl applies</div>
        Basically, dir="auto" is changed to act as a feature that
        triggers the browser to use the directionality implied by
        the value of the lang attribute.

 EXAMPLE: When e.g. lang="he" applies to the element where the 
dir="auto" occurs, then let the directionality default to the 
directionality implied by that language tag, and let the directionality 
of child elements vary according to the value of the lang="*" attribute 
of the child element. 

 ADVANTAGES: The new behavior would only apply for the child elements 
that the @lang element applies to. Meaning that the old behavior can 
continue to apply for elements where the @lang attribute doesn’t apply. 
This way we would isolate the new behavior and could, as well, just 
retain the dir attribute and its old values.

    WHAT ABOUT dir="rtl" AND dir="ltr": These values can be kept. They 
will trigger the new isolation behavior if the element with dir="rtl" 
or dir="ltr" set is a child of an element for which dir="auto" is set. 

 REAL WORLD EXAMPLES: 

(1) mouse.co.il 
    Looking at a couple of Hebrew web pages, it seems like it is common 
to apply dir="rtl" - and sometimes lang="he" - only to the <title> 
element. The site at http://mouse.co.il follows that practise. Thus, 
for mouse.co.il, the new behavior would not apply.

(2) Hebrew Wikipedia
    The Hebrew Wikipedia pages places both lang="he" and dir="rtl" on 
the root element - html. Thus, for Hebrew Wikipedia, the new behavior 
would not apply until they change dir="rtl" to dir="auto".

Thus, this brief survey of real world examples indicates that this new 
behavior is likely to not impact very many current pages. However, it 
is possible that it should be made unconforming to use dir="auto" if 
there is no lang attribute that applies. Or that the new behavior 
should be made dependt on the dir="auto" attribute occuring on the 
"root element" of the @lang attribute:
  <div lang="he" dir="auto">
    <div>lang on root element of @lang</div>
  </div>
  <div lang="he" >
    <div dir="auto">lang *not* on root element of @lang</div>
  </div>
-- 
leif halvard silli

Received on Wednesday, 20 February 2013 20:44:11 UTC