[Webkit-unassigned] [Bug 69680] Dir attribute is converted into direction property when merging paragraphs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 9 03:21:36 PDT 2011


--- Comment #1 from Aharon (Vladimir) Lanin <aharon at google.com>  2011-10-09 03:21:36 PST ---
Caveat: below are my personal opinions. I do not think that there is a standard to follow here.

> should we generate <div dir="ltr">XY</div>
> or <div dir="ltr">X<span dir="rtl">Y</div>?

IMO, the former. The problem with the latter is that you are converting paragraph direction style to inline direction style. While paragraph direction is usually indicated by alignment, and most editors provide buttons to see it and control it, neither is the case for inline direction. Thus, later on, the user has no way of knowing that the <span dir=rtl> is there, and thus will be surprised when things work differently than they do normally. And even if the user figures out what's going on, he has no way of removing the inline direction style, and can not tell whether the caret is inside it or just next to it. This is all very different from the case with other styles, e.g. bolding, where the bolding is obvious in itself - and is made even more obvious by the status of its button, which also gives a way to control it.

(However, this issue should be revisited if WebKit were to start supporting a visualization of the bidi structure of the content during editing.)

> WebKit currently adds direction property when copying content
> inside an element with dir property. But this wouldn't work if
> the copied content was wrapped by span (need to add
> unicode-bidi: embed as well). I don't even know what the correct
> behavior is.

First, about the dir attribute vs direction & unicode-embded styles: stay true to what the source has. If it has mark-up like the dir attribute, use that mark-up. Only use CSS if it has something beyond the mark-up. 

Now regarding copying directional information on the copy command. Here too, I think the guiding principle should be to avoid creating inline direction. Thus, if you are going to be creating a <div> or <p>, I think it is very good to put a dir on it in accordance with the source's computed style (even if the source did not have it explicitly on that element). And if the source already has a <span dir=...>, then by all means copy it verbatim. But I do not think that it is good to create a span with direction when the source did not have it.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list