What does the support mixed text direction setting do?

The support mixed text direction setting is intended for sites that have a mix of left-to-right and right-to-left languages. When the setting is enabled, it automatically sets the text direction for cooked post content, topic titles, category names, and the composer’s preview area, based off the direction of the language that is used. It also sets the text direction for text inputs based off the language that is entered.

As long as the content is separated by a newline, it allows you to have mixed text within an individual post.

How does it work?

The setting only effects how content is displayed by the browser. It doesn’t affect content that is saved to the database. Text is parsed with a regular expression to determine it’s direction. The appropriate dir value is added to the text’s outer HTML tag. Ideally this same behaviour could be accomplished by setting the dir attribute to auto. This can’t be done yet, because dir="auto" is not supported by any IE browsers.

Composing a post

When a post is created, text is entered into a textarea in the composer. The textarea input can only support a single text direction. The direction of the textarea defaults to the direction of the user’s preferred locale. To make typing easier, the setting adds a Toggle Direction button to the composer’s tool bar. Clicking the button will toggle the direction of the entire textarea. As you can see in the screenshot, text in the composer’s preview area has it’s direction set correctly, regardless of the direction set on the textarea.

11 Likes