Entering bidirectional text

As discussed earlier, the order in which data is presented (physical sequence) can be different from the order in which the data is entered (logical sequence).

Example: To enter the string, david is 12 years old., where lowercase characters represent Hebrew or Arabic characters, the user would press the keyboard keys in the following order:

[d] [a] [v] [i] [d] [SPACE] [i] [s] [SPACE] [1] [2] [SPACE] [y] [e] ... [.]

Note: Depending on the implementation of the bidirectional entry support, the user may or may not need to enter a special hot key combination before entering the digit 1.

On a display with right-to-left orientation, the string appears as follows:

dlo sraey 12 si divad

Note that the default orientation for the bidi entry fields was right to left, but entry fields that are to receive numeric input should rather be set to a left-to-right orientation.

Bidirectional text data entry involves moving the cursor from right to left when entering national text, and from left to right when entering English text and numbers. The cursor can also remain stagnant while the characters are entered. This will cause all the characters previously entered while the cursor is stagnant to be shifted in order to accommodate the newly entered character.

A visual cue may be used to indicate the direction of the cursor movement. The cursor shape can change to point in the direction of the next character, or the direction can be shown on a control line.

There are two acceptable ways to manage cursor operation: visual cursor movement and logical cursor movement. With visual cursor movement, pressing the right arrow key should move the cursor one position to the right and pressing the left arrow key should move the cursor one position to the left, whatever the direction of the text adjacent to the cursor (in some implementations, the cursor may stay in place and only change direction for one keypress at the boundary between two text segments at different bidi levels). JFC/Swing implements visual cursor movement.
The Standard Widget Toolkit (SWT) follows whatever the underlying platform implements. Microsoft Word has options to alter both cursor movement and visual selection behavior.


Guideline H1

Use the services offered by the underlying software or the platform to support bidirectional text entry in the same order as the text is pronounced.

Example: On the IBM AIX/IBM Blade Center platform, pressing "Alt+Enter" inverses the screen direction, pressing "Alt+RightShift" enables the Hebrew/Arabic keyboard, and pressing "Alt+LeftShift" enables the English keyboard. On Windows platforms, LTR paragraph orientation is achieved by pressing "Ctrl+LeftShift" and RTL paragraph is achieved by pressing "Ctrl+RightShift". On Java/Swing platforms, the paragraph orientation can be toggled from LTR to RTL and vice-versa by pressing "Ctrl+Shift+O". During data entry on both Windows and Java/Swing platforms, it is enough to start typing bidirectional text to switch from LTR to RTL.

On platforms that support bidirectional scripts, your product can call upon services that are available either from the underlying software or from the platform itself to support bidirectional text entry. Handling bidirectional text becomes relatively simple for applications that run in an environment where the presentation of text is performed using standard services or APIs provided by the platform. Platform interfaces provide services for the application to correctly present and accept bidirectional text. These platforms create a flexible bidi environment, even for 'bidi-unaware' applications that were not intended to accommodate bidirectional scripts.


Guideline H1-1

Allow the user to select the text direction if technically possible.

To properly display text in any language, your product should allow enforcement of text direction depending on the user's preference, if it is technically possible. Special attention should be given to applications developed for mobile devices as most operating systems and software development kits for mobile do not yet provide full bidirectional support. There are some JavaScript frameworks such as Dojo Mobile that provide support for bidirectional languages.