[Bug 16564] The directionality of a textarea should be determined based on its parent if its value does not have any strong characters

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16564

--- Comment #3 from Aharon Lanin <aharon.lists.lanin@gmail.com> 2012-03-29 10:39:29 UTC ---
(In reply to comment #1)
> The reason for the current spec language is to keep the reordering results
> consistent with plaintext. In plaintext, a paragraph of neutral characters is
> ordered LTR.
> 
> I don't mind defaulting to the inherited direction when the element is empty,
> if that makes for a better UI, but when it has neutral content, it should
> default to LTR regardless of the inherited direction.

The HTML spec says LTR for any dir=auto element with all-neutral content, not
just <textarea>. Ehsan, does this bother you for all elements, or specifically
for <textarea>, because of the caret flip-flop problem?

Please note that the behavior of <textarea dir=auto> is actually more in the
province of CSS, since the HTML spec's default style sheet says that it gets
unicode-bidi:plaintext, and that says that for each paragraph of the
<textarea>, the base direction is determined by the first strong character in
the paragraph, or LTR if none. The HTML directionality of the textarea is
therefore largely moot.

In any case, I agree with fantasai. That is, the textarea in <div
dir=rtl><textarea dir=auto>--></textarea></div> has to be displayed as "-->"
(i.e. LTR), not <--, despite the parent being RTL. If, for a neutral value, it
depended on the ancestor, then the display when entered will not necessarily
match the way it is later displayed in a <pre> which happens to be displayed in
a parent of the other directionality, e.g. in an opposite-directionality page.
Also, LTR for all-neutral happens to work nicely for phone numbers (e.g. "(987)
654-3210"), which need to be displayed LTR.

As fantasai said, to avoid the caret flipping back to the left side after a
newline and then again to the right when an RTL character has been entered, it
is possible to change the CSS spec for the base direction of an *empty*
paragraph in a unicode-bidi:plaintext element to follow the element's direction
style. Alternatively, it could even follow the preceding paragraph's base
direction. But that is a CSS matter. And please note that a non-empty,
all-neutral paragraph (like "-->" or "2. ") will still be LTR (until the user
adds on an RTL character). As I indicated above, I think that this is the way
it should be.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 29 March 2012 10:39:37 UTC