W3C home > Mailing lists > Public > public-i18n-bidi@w3.org > July to September 2010

Re: per-paragraph auto-direction, a.k.a. dir=uba

From: Aharon (Vladimir) Lanin <aharon@google.com>
Date: Fri, 24 Sep 2010 07:25:31 +0200
Message-ID: <AANLkTi=i3LeO6gwBmCA_Lh4pSKy0FEyjnXxeHi+6x_0x@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: Matitiahu Allouche <matial@il.ibm.com>, "Phillips, Addison" <addison@lab126.com>, Adil Allawi <adil@diwan.com>, Behdad Esfahbod <behdad@behdad.org>, Ehsan Akhgari <ehsan@mozilla.com>, public-i18n-bidi@w3.org, Shachar Shemesh <shachar@shemesh.biz>
I am presuming that you meant that the <input> has dir=auto or plaintext (if
it didn't, nothing interesting at all would happen when you type Farsi into
it).

If the <input> has dir=auto autodirmethod=plaintext or, if we prefer that
syntax, dir=plaintext or, even more simply, if it just had
unicode-bidi:plaintext, without setting dir at all, it would indeed work the
way you want it to work: its direction would stay ltr. I do not think it is
relevant whether the HTML syntax we choose for this is dir=plaintext or
dir=auto autodirmethod=plaintext. Either way, the effect of the HTML is to
leave the direction alone and set unicode-bidi to plaintext. But I do not
think that this is a good use case for plaintext. The whole point of
plaintext is to allow per-paragraph direction, and <input> certainly does
not allow multiple lines of text. And submitdir would not work well for such
an <input>, which is a definite minus. In the recent discussions, BTW, we
never said that we wanted uba/plaintext to work on <input>; we only spoke
about <textarea> and <pre>.

Or did you mean that the <input> has dir=auto and its autodirmethod is not
plaintext? In this case, its CSS direction would indeed change to rtl. I
have always thought that this is good because it is more intuitive (why the
heck is the bidi ordering changing to rtl if the direction isn't?!), and
makes the effective direction available to scripts, and makes the definition
of submitdir simpler. However, as you say, if the <input> has margin-start
set, it would indeed now behave as margin-right, and this is not very good.
But I think that this is more of an issue in the definition of margin-start,
etc. I would claim that in most cases, one really wants these properties to
look at the parent's direction, not the element's own direction. As
evidence, I would bring a slightly different case: an <input> for an
always-ltr field like a phone number or email address. It would be coded as
<input dir=ltr>. But if it has margin-start, this would get interpreted as
margin-left, which probably isn't appropriate in an rtl page. Why would I
give it margin-start instead of margin-right? Because the page has LTR and
RTL versions, and we want to change as little as possible between them in
the HTML and CSS. As another piece of evidence, I would bring float:start. I
am not even sure that CSS3 allows start and end values for float (does it?),
but the use case is pretty obvious: where you want a float:left in an LTR
UI, you want a float:right in an RTL UI. It is pretty obvious that it has
nothing at all to do with the direction of the element itself.

I have not brought up my problem with margin-start, float, etc. because I
agree that in some cases, you really do want it to be based on the element's
own direction, not the parent's. And in the case of text-align, it is pretty
obvious that it should always be dependent on the element's own direction.
It would be pretty ridiculous to have float be defined to go by the parent
and text-align to go by the element itself. In any case, there is a simple
workaround for all these examples: put a <div> or <span> around the element
in question and put the margin-start or float on the <div> or <span>.

Aharon

On Fri, Sep 24, 2010 at 3:27 AM, fantasai <fantasai.lists@inkedblade.net>wrote:

> On 09/23/2010 11:47 AM, Aharon (Vladimir) Lanin wrote:
> >>  I'm thinking more about form controls, and I think 'plaintext' should
> >>  not be requiring dir=auto. In most cases, you want to use the inherited
> >>  direction for styling the form control: you don't want margins and
> >>  borders suddenly shifting around because the user has entered RTL text,
> >>  you want them to remain steady and match the surrounding UI's
> direction.
> >>  What you want to shift is only the base paragraph direction and the
> >>  text's horizontal alignment-- and "unicode-bidi: plaintext" alone will
> >>  handle for you.
> >
> > I am not sure what you mean here. Form controls? Could you give an
> example?
>
> The UI of my web app is in English. I have an <input>. It's empty. I type
> Farsi text in it. It's margin-start now becomes margin-right, because its
> 'direction' is automatically changed by its contents. This is bad. It
> should
> not change. Only the bidi ordering of my text and its text-align should
> change.
> The 'direction' property of the form element should not change.
>
> ~fantasai
>
Received on Friday, 24 September 2010 05:26:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 September 2010 05:26:28 GMT