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

While working out the semantics of dir=auto, we forgot to deal with how it
should interact with user-visible attributes like title, alt, and
placeholder (as well as the value attribute on <input> elements of type
text, search, button, submit, and reset).

Currently, the HTML5 spec says that all attribute values must be displayed
to the user in the directionality of the element to which the belong. The
spec gives no way to specify the directionality of attributes when it must
differ from that of the element itself (except by using LRE, RLE, and PDF).
Nor does it give a way to specify that an attribute must be displayed in
its own estimated direction. This situation, which was already painful with
placeholder (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=15488)
becomes insufferable when the user-visible attribute is on an element with
dir=auto or a descendant of one, since the directionality of an element
with dir=auto is chosen on the basis of descendant text nodes and is
completely unrelated to the value of the attributes in its scope of
influence.

I am looking for ideas on how to fix this.

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.

The next step is to file a bug on HTML5, but I think this deserves some
discussion here first.

Aharon

Received on Wednesday, 22 February 2012 15:05:01 UTC