Re: dir=auto makes no sense for descendant user-visible attributes

I am afraid that I have no  silver bullet for this issue, and I will go 
along with Aharon's proposal, but with some needed (IMHO) simplification, 
because if it needs 9 examples to describe it, it is too complicated for 
my feeble mind.
So here is what I propose.
a. If attribsdir is not specified and the element has (explicitly or by 
inheritance) a dir different from auto, its dir applies to its visible 
attributes (no change from current spec).
b. If attribsdir is not specified and the element has dir=auto (explicitly 
or by inheritance), dir=auto also applies independently to each of the 
visible attributes.
c. If attribsdir is specified, it overrides the dir of the element. If 
attribsdir=auto, the direction is computed independently for each of the 
visible attributes.

Unless I am wrong (it has happened in the past), this proposal creates no 
backward compatibility problem, it is easy to understand and it allows any 
weird combination of different directions for element data and attributes' 
text to be solved by specifying attribsdir=auto and prefixing the 
attribute value by ‎ or ‏ as needed.

Shalom (Regards),  Mati
       Bidi Architect
       Globalization Center Of Competency - Bidirectional Scripts
       IBM Israel
       Mobile: +972 52 2554160




From:   Ehsan Akhgari <ehsan@mozilla.com>
To:     "Aharon (Vladimir) Lanin" <aharon@google.com>
Cc:     public-i18n-bidi@w3.org, Martin J. Dürst <duerst@it.aoyama.ac.jp>
Date:   24/02/2012 19:30
Subject:        Re: dir=auto makes no sense for descendant user-visible 
attributes



I'm fine with attribsdir as you proposed, although I'm not quite sure 
about the more complex syntax, since it's so different to the way other 
attributes in HTML work.

Let's hear what others think.

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>


On Thu, Feb 23, 2012 at 11:53 PM, Aharon (Vladimir) Lanin <
aharon@google.com> wrote:
Good example.
In the past, Ian has already rejected titledir etc.
Perhaps they will be more receptive to attribsdir, since it's just one 
attribute and tackles some serious problems.
Your example could be handled by also allowing syntax like 
"title:rtl;placeholder:ltr". Even just " placeholder:ltr" could do if the 
other attributes then follow the default (which in this case would 
presumably be rtl despite dir=ltr on the <input>). Since it does not 
inherit, there would not be too much difficulty supporting the complex 
syntax.
But attribsdir would still be useful even if it only allowed a simple 
value.
Aharon
On Feb 23, 2012 6:11 PM, "Ehsan Akhgari" <ehsan@mozilla.com> wrote:
How about something like:

<input name="phone" title="TELEPHONE" placeholder="(123) 456-7890">

If we introduce an attribsdir attribute, I can see people asking to 
differentiate between different attributes, such as the example above.  
>From a bidi perspective, the ultimate solution is to have a directional 
attribute for every user visible attribute, such as titledir, 
placeholderdir, etc.  But honestly I don't expect such a proposal to be 
easily accepted in WHATWG, given the recent resistance towards 
placeholderdir.

--
Ehsan
<http://ehsanakhgari.org/>


On Thu, Feb 23, 2012 at 6:49 AM, Aharon (Vladimir) Lanin <
aharon@google.com> wrote:
Well, I, for one, am not so happy with my proposal :-).

Its solution is to apply dir=auto to the individual user-visible 
attributes, even though in most cases the values of such attributes are 
not dynamic, but localized to the page locale, e.g. (in an English page) 
<input dir="auto" name="purpose" placeholder="The purpose of your 
visit.">. Using estimation for them is not just wasteful, but bound to 
reach the wrong conclusion occasionally.

And it does not address the long-standing issue of no way to set the 
directionality of an attribute (other than using formatting 
characters). The canonical examples are:

- <input dir="ltr" name="telephone" title="PHONE NUMBER.">, which has to 
be worked around as <span title="PHONE NUMBER."><input dir="ltr" 
name="telephone"></span>
- <input dir="ltr" name="telephone" placeholder="PHONE NUMBER.">, which 
has no workaround other than RLE + PDF.

What if we could instead have a new attribute, attribsdir="ltr|rtl|auto", 
which would determine the directionality in which the element's 
user-visible attributes must be displayed. A very important part of this 
would be the default value. IMO, it would be best if it could default to 
the dir attribute value of the closest ancestor - or the element itself 
unless it is <input> or <textarea> - that has an explicit dir attribute 
with a value other than "auto". If there is no such ancestor, the default 
is "ltr". Thus:

- the only way to get attribsdir=auto is to specify it explicitly
- the explicit dir attribute value of <input> and <textarea>, which is 
presumably meant to correspond to the directionality of their content, not 
their user-visible attributes, does not affect their default attribsdir.
- with the exceptions of <input dir="...">, <textarea dir="...">, and 
<whatever dir=auto>, the result is backward-compatible.

Examples:

1. <html><body><div title="?">: ltr

2. <html dir=rtl><body><div title="?">: rtl

3. <html><body><div dir=rtl title="?">: rtl

4. <html><body><div><div dir=rtl><div><div title="?">: rtl

5. <html dir=rtl><body><div><input dir=ltr title="?"> : rtl

6. <html><body><div dir=rtl><div dir="auto" title="?">hello</div>: rtl

7. <html><body><div dir=rtl><div dir="auto">ltr content<div title="?">: 
rtl

8. <html dir=rtl><body><div title="?" attribsdir="ltr">: ltr

9. <html dir=rtl><body><div title="?" attribsdir="auto">: auto

Even if we couldn't get the <input> and <textarea> exception, we would 
still be ok - the page would just have to specify attribsdir explicitly on 
the problematic inputs.

Aharon

On Thu, Feb 23, 2012 at 11:32 AM, "Martin J. Dürst" <
duerst@it.aoyama.ac.jp> wrote:
On 2012/02/23 1:11, Ehsan Akhgari wrote:
On Wed, Feb 22, 2012 at 10:04 AM, Aharon (Vladimir) Lanin<
aharon@google.com
wrote:

One possibility is to divorce user-visible attributes from their elements'
directionality completely, always estimating the directionality of each
attribute by its content. This suffers from backwards compatibility
problems (since estimation is a heuristic that sometimes gives the wrong
answer).

A better possibility is to divorce it only for elements under the
influence of dir=auto. Thus, if an element has dir=auto (explicitly or
implicitly, the latter being the case for<bdi>), each of the attributes in
the subrtree rooted at that element, with the exception of elements
specifying dir="ltr" or dir="rtl" and their descendants, must be displayed
to the user as if they had a dir=auto of heir own.


I like the second proposal better.  Although I have to say that it has 
been
worded a bit vaguely.  What I have in mind is for the title attribute in
the following example to have a resolved RTL direction:

<p dir="auto" title="RTL TEXT followed by ltr text">ltr text FOLLOWED BY
RTL TEXT</p>

I agree with Ehsan that the second proposal is better. It's something that 
comes quite naturally once one gets used to it.

Regards,    Martin.

Received on Sunday, 26 February 2012 15:13:56 UTC