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

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 Thursday, 23 February 2012 16:12:09 UTC