Bug 18490 - make any element with an explicit lang or dir attribute bidi-isolated by default
make any element with an explicit lang or dir attribute bidi-isolated by default
Status: ASSIGNED
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec
unspecified
PC Linux
: P2 normal
: ---
Assigned To: Erika Doyle Navara
HTML WG Bugzilla archive list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-05 06:04 UTC by Amir E. Aharoni
Modified: 2013-10-11 00:35 UTC (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amir E. Aharoni 2012-08-05 06:04:31 UTC
This idea came to me while editing Wikipedia, which is a massively multilingual site.

An element that has an explicitly defined lang attribute can also have different directionality from the enclosing element. Even more so for any element that has an explicit dir attribute. It is also likely that an element with a different directionality should be bidi-isolated using <bdi> or "unicode-bidi: isolate".

Therefore, bidi isolation should be the default for such elements. Of course, it should be possible to override it if that's what the user wants.
Comment 1 Aharon Lanin 2012-08-06 15:15:13 UTC
IMO, this is the correct approach for new pages. (In fact, I would even say unicode-bidi:isolate for elements with the dir attribute, and unicode-bidi:plaintext for elements with the lang attribute but lacking dir.) And in fact it is easy to do that in your (new) page's own CSS. However, one has to keep in mind that isolation is not implemented in IE9, and may or may not be implemented in the final release of IE10. So, if you need to have your page work bidi-wise for a high percentage of users, this just isn't good enough, not for a long while yet. :-(

The other major concern here is backward compatibility. That is why I said above "new" pages. Applying bidi isolation to all elements with the dir attribute *will* break some existing pages.

On the other hand, my guess is that applying bidi isolation to something with the lang attribute (and lacking a dir attribute) is unlikely to break existing pages, so it is probably a good idea.
Comment 2 Robin Berjon 2013-01-21 16:00:14 UTC
Mass move to "HTML WG"
Comment 3 Robin Berjon 2013-01-21 16:02:58 UTC
Mass move to "HTML WG"
Comment 4 Aharon Lanin 2013-04-24 02:58:50 UTC
Recently I investigated the effects of the dir attribute in IE, and discovered some significant new information (at least it was new to me) that affects the conclusions I reached as described in comment 1.

It is true that no existing version of IE, including IE10, implements isolation (i.e. unicode-bidi:isolate). However, it turns out that IE8 and up, unless it is in IE7 compatibility or quirks mode, has modified the behavior of unicode-bidi:embed that is non-standard and not interoperable with other browsers, and in most cases acts similar to isolation.

This behavior appears to be that an inline element bearing the dir attribute affects the visual ordering of its surroundings as if it were immediately preceded by an invisible character of the element's directionality, but immediately followed by an invisible character of the parent element's directionality. Thus, 

<div dir="ltr">א ==> <span dir="rtl">*</span></div>

is displayed as

* <== א

which is as specified and the same as FF, WebKit, and IE7 and below, but

<div dir="ltr"><span dir="rtl">*</span> ==> ב</div>
<div dir="ltr"><span dir="rtl">*</span> ==> 123</div>

is displayed as

* ==> ב
* ==> 123

which is the opposite ordering from IE7, the spec, and from all other major browsers.

This unusual approach cannot be said to approximate the standard embedding semantics. While it certainly is not isolation either, its effects are actually the same as isolation when both of the following conditions are satisfied:
- The dir attribute value assigned to the inline element is the opposite of its parent element's directionality.
- If the first strong character preceding an inline element with a dir attribute has the same directionality as that element, it too is inside an inline element with a dir attribute.

These conditions are actually more commonly satisfied than not, because:
- It is usually redundant to put a dir attribute on an element if its parent already has that directionality.
- If a software application creating a web page bothers to declare the directionality of one piece of opposite-direction text that it needs to display inline, it is likely to do the same for another.

Thus, once could say that under the most common circumstances, the behavior of IE8 and up (when acting as IE8 and up) is closer to isolation than to embedding. But even if that seems like a stretch, it is quite safe to say that currently there is a lack of interoperability in the behavior of the dir attribute between the current versions of IE and of the other major browsers (which continue to follow the current HTML specification and give the dir attribute embedding semantics).
Comment 5 Ian 'Hixie' Hickson 2013-04-26 23:52:46 UTC
FWIW, one thing to consider here is how implementors perceive this part of the spec. If we keep changing it, they'll start to think of it as unstable and not worth their attention, and it'll slow down the rate at which existing features are implemented.

Also, we should be really careful to avoid "magic", especially with something as complicated as bidi. We've done that pretty well so far by having things happen when explicitly invoked, e.g. with <bdo>, <bdi>, and dir="". We're moving a little away from this with things like dir=auto. I would advise caution when it comes to making elements have "magical", or "do what I mean", behaviour when using apparently unrelated attributes like lang="".
Comment 6 Aharon Lanin 2013-06-11 13:30:33 UTC
So, let's separate the two proposals. This bug can remain the home of the lang proposal. I have filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=22326 to proceed with using isolation for the dir attribute.

Please note that the IE8+ behavior described above for <span dir="ltr|rtl"> also applies for <bdo dir="ltr|rtl">.
Comment 7 Ian 'Hixie' Hickson 2013-07-03 18:15:27 UTC
Aharon — those bugs are on the HTMLWG spec. Let me know if you'd like me to clone them into WHATWG bugs as well so that they end up on my pile of things to look at.
Comment 8 Aharon Lanin 2013-07-04 07:18:05 UTC
(In reply to comment #7)

It sounds good, but I don't really understand the implications of cloning. Robin had counseled us to file on the HTMLWG spec, and he would clone as necessary. I obviously want both the HTMLWG and WHATWG specs to change in this regard.
Comment 9 Robin Berjon 2013-09-03 12:38:54 UTC
(In reply to comment #8)
> (In reply to comment #7)
> 
> It sounds good, but I don't really understand the implications of cloning.
> Robin had counseled us to file on the HTMLWG spec, and he would clone as
> necessary. I obviously want both the HTMLWG and WHATWG specs to change in
> this regard.

Sorry if I was unclear, that's not what I meant. I meant to indicate that you should clone as you feel is needed, and that others (myself included) could do it for you if they felt it necessary — not that I'd handle it in all cases.

Ideally, I'd prefer to have just one bug list for every one and on occasion split some bugs when there's disagreement. For most parts it would be a lot simpler. But I guess that ship has sailed.
Comment 10 Aharon Lanin 2013-09-08 12:24:17 UTC
Ok, let's please clone https://www.w3.org/Bugs/Public/show_bug.cgi?id=22326 to WHATWG. I am not sure how to do that.
Comment 11 Ian 'Hixie' Hickson 2013-09-24 22:13:00 UTC
(Off topic) (In reply to Robin Berjon from comment #9)
> 
> Ideally, I'd prefer to have just one bug list for every one and on occasion
> split some bugs when there's disagreement. For most parts it would be a lot
> simpler. But I guess that ship has sailed.

I'm happy to do that if we can avoid the problems that led to the forking in the first place -- feel free to mail me about it or catch me on IRC to discuss it.
Comment 12 Sam Ruby 2013-10-08 17:38:44 UTC
Ping?  This is gating approval of the HTML5 overview of testing in view of permissive CR exit criteria:

http://lists.w3.org/Archives/Public/public-html-admin/2013Oct/0008.html
Comment 13 Erika Doyle Navara 2013-10-09 21:07:46 UTC
AFAICT this bug was tagged as CR blocking (when Robin did that first-pass audit of HTML5 bugs during the San Jose F2F in April), but its dir="" counterpart [1] (the one which would fulfill the i18n WG proposal[2]) was not.

Changing the default bidi behavior for elements with lang="" specifically *in time for the HTML5.0 CR spec* doesn't seem to be an explicit ask coming from the bug filer or the i18n WG. If this is indeed the case, it seems to me like this bug should instead be considered alongside the larger issue (with greater potential back-compat impact) of changing the bidi default for dir="" during the HTML5.1 timeframe, and the CR keyword be removed.

Unless I hear reasons otherwise in the next couple days, I will be removing the CR keyword.

[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=22326 
[2] http://www.w3.org/International/wiki/Html-bidi-isolation
Comment 14 Erika Doyle Navara 2013-10-11 00:35:46 UTC
Removing CR keyword per confirmation from i18n WG that they are not requesting this to be marked such: http://lists.w3.org/Archives/Public/public-html-admin/2013Oct/0015.html

The related bug 22326 (for dir) however, should (and will) be marked with the CR keyword.