w3c / alreq

Documenting gaps and requirements for support of Arabic and Persian on the Web and in eBooks.
Other
60 stars 31 forks source link

Need support for dirname attribute #216

Open r12a opened 4 years ago

r12a commented 4 years ago

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:

Screenshot 2021-01-21 at 18 12 42

However, if just first-strong heuristics are used to decide the base direction for the inserted book name, it will incorrectly produce:

Screenshot 2021-01-21 at 18 14 00

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

Gecko bug (already raised)

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.

r12a commented 4 years ago

The first comment in this issue contains text that will automatically appear in one or more gap-analysis documents as a subsection with the same title as this issue. Any edits made to that comment will be immediately available in the Editor's draft of the document. Proposals for changes or discussion of the content can be made by adding comments below this point.

Relevant gap analysis documents include: _AdlamArabic/PersianHebrewKashmiriN'KoUighur_

xfq commented 2 years ago

There are many related specs, like Web APIs (and maybe Web IDL and/or ECMAScript), data formats (like JSON-LD), manifests, and maybe markup languages. There will likely be new standards in the future that have this problem. How do we judge this problem has been solved?