Description
This issue is common to all RTL scripts.
When strings are passed around, some applications don't receive or use information about the appropriate base direction to use for those strings when they are rendered as part of a page.
This can lead to text being incorrectly aligned, and to text within a sentence or paragraph being incorrectly ordered. Some of this can be addressed by using heuristics to detect the direction first-strongly directional character in the string, but some strings can fail such heuristics.
For example, imagine a service which retrieves book names on an English page. If the page retrieves from the database an Arabic book name that begins with LTR letters, it should look like this:
However, if just first-strong heuristics are used to decide the base direction for the inserted book name, it will incorrectly produce:
For these cases the databases or JSON files, etc., from which such strings are pulled need to contain metadata about the base direction which needs to be applied to correct the display. The appropriate direction can be communicated to the backend storage from a form input by using the dirname attribute. This indicates the base direction in force for a form control, whether it is derived from the surrounding text or set manually by the user while typing.
More:
The GAP
The direction of the field is passed with the form data by Chrome and WebKit, but not by Gecko. Note that Gecko also doesn't change the computed direction of the form field when the user manually sets the direction.
Priority
Basic, because of its usefulness in ensuring correct directional display of RTL text that starts with a LTR character.
Tests & results
i18n test suite HTML5, dirname
Action taken
Outcomes
All 3 major browser engines, Gecko, Blink, & WebKit, now support relaying the field direction to the server using dirname. It also supports changing the computed direction of a form field when the user manually sets the direction.
See Can I Use?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Fixed
Activity