This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27475 - Examples: illustrate difference between bdo and bdi
Summary: Examples: illustrate difference between bdo and bdi
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other All
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/#the-bdi...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-30 22:13 UTC by contributor
Modified: 2019-03-29 19:47 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2014-11-30 22:13:13 UTC
Specification: https://html.spec.whatwg.org/multipage/semantics.html
Multipage: https://html.spec.whatwg.org/multipage/#the-bdi-element
Complete: https://html.spec.whatwg.org/#the-bdi-element
Referrer: https://html.spec.whatwg.org/multipage/scripting.html

Comment:
Hello, it is hard to understand what the difference between bdo and bdi is,
since there is no example for bdo, also just one example for bdi is not
enough. I understodd after studying a lot of other sources in german, but I
saw also that these people trying to explain these elements to other people,
didn´t understand the elements richt, so there are a lot of failures in their
explanations, I tested and got it now, but one thought is confusing me, which
code should be preferred and why: 

<p>Name: <bdi><input id="name"></bdi></p>

or

<p>Name: <input id="name" dir="auto"></p> 

Posted from: 77.7.144.204 by senol.veli@gmail.com
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Comment 1 senol.veli 2014-12-01 01:51:33 UTC
I would like to expand my question and hope to get help.

If we got an html document and all contents are for example in arabic, the we should do it this was:

<html lang="en" dir="rtl">
...
</html>


if we got an html document where the main contents are for example in german but we got a section or paragraph in arabic we should use:

<html lang="en">
<p lang="ar" dir="rtl">...</p>
</html>

if we got an html document where nearly all contents are in english but in one paragraph there is a span of text in arabic, surrounded by english text, we should use:

<html lang="en">
<p>This is a span of text in english <bdo dir="rtl">إيان إيان إيان</bdo> and another span of text in english</p>
</html>

Is that right? Think so, because the recommondation is explaining if we know there is text in another directionality and we know the direction we should mark with bdo.

Ok but there is a Problem, similar to your example given for the bdi-element, if the text after </bdo> begins with a number:

<html lang="en">
<p>This is a span of text in english <bdo dir="rtl">إيان إيان إيان</bdo> 55555 and another span of text in english</p>
</html>

This is not working, but the following is working:

<p>This is a span of text in english <bdo dir="rtl">إيان إيان إيان</bdo> <bdo dir="ltr">55555 and another span of text in english</bdo></p>

But this is also working:

<p>This is a span of text in english <bdi>إيان إيان إيان</bdi> 55555 and another span of text in english</p>

The last to codes above are not recommented in specs or is it?


Thanks a lot

Veli Senol
Comment 2 senol.veli 2014-12-01 01:56:11 UTC
made a mistake, the first code-line should have been:

<html lang="ar" dir="rtl">
Comment 3 Addison Phillips 2015-09-02 14:24:04 UTC
A quick search of the web turns up a number of people confused about what `bdo` does. The text in 4.5.26 and 4.5.27 are good enough for experts but do not provide the necessary information for users to understand how to use these special purpose elements. The links provided for bidi are to the UAX, which is not a particularly accessible reference.

I would suggest:

1. Add a short example to 4.5.27 showing bdo being used to override text direction. The text says what it does, but "override text direction" has a very different meaning in this context than the casual reader would infer.

2. Include a link to the I18N WG's authoring guidelines in the section on @dir (3.2.5.6 in 5.0). Cluttering up HTML with a complete reference on how to use bidi seems out of scope. Have an explicit pointer to @dir in bdo and bdi.

3. Consider a revision to the example in the @dir section to match the guidelines (richard: thoughts?)
Comment 4 Richard Ishida 2016-07-22 10:02:08 UTC
Not sure what is the status of this bug, but for the earlier contributors who were trying to understand the difference between dir, bdi and bdo you can find explanations at https://www.w3.org/International/articles/inline-bidi-markup/

(I also just added some extra text to help clarify the difference between bdi and bdo.)
Comment 5 Lina Kemmel 2016-07-24 12:24:25 UTC
(In reply to contributor from comment #0)
> ... 
> which code should be preferred and why: 

This strongly depends on the intended use.

> 
> &lt;p&gt;Name: &lt;bdi&gt;&lt;input id="name"&gt;&lt;/bdi&gt;&lt;/p&gt;
> 

BDI (meant to isolate a text fragment from its surroundings) doesn't make much sense here, since it applies to the entire paragraph content. In order to isolate *some part(s) of the content* in a text input (which does not accept inline markup), we may use the Unicode control characters RLI, LRI, FSI, PDI.

> or
> 
> &lt;p&gt;Name: &lt;input id="name" dir="auto"&gt;&lt;/p&gt; 

This sets base direction of the text to "auto", i.e. according to the first strong character.
Comment 6 Lina Kemmel 2016-07-24 12:54:13 UTC
(In reply to Richard Ishida from comment #4)
> Not sure what is the status of this bug, but for the earlier contributors
> who were trying to understand the difference between dir, bdi and bdo you
> can find explanations at
> https://www.w3.org/International/articles/inline-bidi-markup/
> 
> (I also just added some extra text to help clarify the difference between
> bdi and bdo.)

For BDO itself, I think it is also worth to illustrate the difference between |bdo dir='ltr'| and |bdo dir='rtl'|:

Both allow to override the standard behavior, but:
  - |bdo dir=ltr| causes the enclosed characters to be treated as strong LTR characters,
  - |bdo dir=rtl| causes the enclosed characters to be treated as strong RTL characters.
========
Also, only BDO is usually associated with "overriding the UBA" (e.g. in https://html.spec.whatwg.org/multipage/semantics.html#the-bdo-element).

But, actually, all explicit directional formatting characters and their equivalents do "override" the UBA ... well, probably not "[just] UBA", but the "standard implicit UBA" - since the directional formatting characters themselves are part of the standard.
Comment 7 Domenic Denicola 2019-03-29 19:47:42 UTC
https://github.com/whatwg/html/issues/4468