Re: [w3c/manifest] Editorial: clarify when/how 'auto' is applied (#926)

Not quite, but you're closer.  When it comes to deciding how to display the string, the _actual_ base direction can only be LTR or RTL.  The `dir` _property_ indicates how an application should _work out_ the base direction of the string: if it's set explicitly to `ltr` or `rtl`, that's straightforward; if the value is `auto`, the application has to look for the first strong character in the string to figure out what the base direction will be.

But you're right that the base direction we're concerned with isn't the direction of the surrounding text: it's the direction that should be applied to the string when it is in place for display.

Let's look at an example in HTML.  Let's suppose we have a Hebrew string which will be inserted into an English HTML page (where the overall direction of the paragraph is LTR). Here's the string:

![Screenshot 2020-07-27 at 10 20 46](https://user-images.githubusercontent.com/4839211/88525741-e210ab80-cff2-11ea-9d38-9b20f732cbbc.png)

Suppose the application creates the following markup, because, although it knows the language of the string, it doesn't know anything about the appropriate base direction for the string itself:

`<p>We found "<span class="result" lang="he">[Hebrew here]</span>".</p>`

The result will be:

![Screenshot 2020-07-27 at 10 14 32](https://user-images.githubusercontent.com/4839211/88525021-0029dc00-cff2-11ea-9ee2-c9ee1fdb4abf.png)

The inserted text has inherited the LTR base direction of the surrounding text, because no other information was to hand. The order of the text (the locations of the comma and 'W3C') is incorrect.

However, if the string has accompanying medata to say that it should be displayed RTL, the application can take that into account while inserting the data and produce the following markup:

`<p>We found "<span class="result" lang="he" dir="rtl">[Hebrew here]</span>".</p>`

Now the Hebrew text will be displayed correctly, because the base direction for the inserted string is correctly established.

![Screenshot 2020-07-27 at 10 20 05](https://user-images.githubusercontent.com/4839211/88525655-c3aab000-cff2-11ea-9c27-8700475448bf.png)

This is a simplified example, to get across the ideas about the scope of the base direction. The introduction of an `auto` property value and `bdi` or `dir="auto"` markup introduces various other options, which it's not necessary to go into here, other than to say that an `auto` value in metadata indicates that either the application doing the inserting needs to work out the base direction for the inserted text, or (in HTML) the `dir` attribute should be set to `auto` and the HTML parser will need to work out the text direction for the text inserted into the span.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/pull/926#issuecomment-664247579

Received on Monday, 27 July 2020 09:50:09 UTC