Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdi and bdo interactive examples #1041

Merged
merged 3 commits into from
Jul 26, 2018
Merged

Conversation

chrisdavidmills
Copy link
Contributor

As part of the final set of HTML interactive examples (#999), I've written some examples for <bdi> and <bdo>.

Note that Florian already attemped these in #880. I wasn't sure if there was a good way for me to add onto his PR, so I've just created a new one.

@wbamberg wbamberg self-requested a review July 24, 2018 14:25
<li><bdi>الرجل القوي إيان</bdi>: 1st place</li>
<li><bdi>Evil Steven</bdi>: 2nd place</li>
<li><bdi>François fatale</bdi>: 3rd place</li>
<li>تیز سمی: 4th place (algorithm confused without BDI!)</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit confusing, because the order in the source is the same as the order in the output, so it's easy to think "so what".

What do you think about enclosing the name in a span, so you can really see the difference? e.g.

<h1>World wrestling championships</h1>

<ul>
   <li><span class='name'>Evil Steven</span>: 1st place</li>
   <li><span class='name'>François fatale</span>: 2nd place</li>
   <li><span class='name'>تیز سمی</span>: 3rd place</li>
   <li><bdi class='name'>الرجل القوي إيان</bdi>: 4th place</li>
   <li><span class='name' dir='auto' >تیز سمی</span>: 5th place</li>
</ul>

(this is probably closer to actual usage, since AFAIK this usually comes up when you want to add a string dynamically and don't know its directionality ahead of time, and in that case you might want a way to target the elements.)

(I've also added a version using dir='auto', and changed the ordering a bit to show the error case before the fixed case. Not sure these are better, that's just how I would have done this.)

To further emphasise it you could add something like:

.name {
    color: #f00;
}

...in the CSS:

screen shot 2018-07-24 at 3 08 10 pm


<p>Looks like this in Hebrew: <span dir="rtl">אה, אני אוהב להיות ליד חוף הים</span></p>

<p>In the computer's memory, this is stored as <bdo>אה, אני אוהב להיות ליד חוף הים</bdo></p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://www.w3.org/International/articles/inline-bidi-markup/#override, dir is mandatory for <bdo>, and the example accompanying that article uses it: https://www.w3.org/International/articles/inline-bidi-markup/index-data/bdo.html.

(Our docs should say this, too.)

@chrisdavidmills
Copy link
Contributor Author

I agree with your suggestions on this, so have made the necessary changes. Thanks!

Copy link
Contributor

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chrisdavidmills !

@wbamberg wbamberg merged commit 5b05fac into mdn:master Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants