C6.30.2Caret at bidi boundarydesignresearch

In mixed-direction text, the caret at a direction switch needs extra rules to decide logical order

Aliases: bidi boundary · direction switch · logical-index choice

What it is

When Arabic embeds English, or Chinese embeds Hebrew, in one line, direction switches appear: logically adjacent characters may not be visually adjacent, and visually adjacent sides may belong to different logical positions. With the caret on that boundary, the system must extra-specify which run the next keystroke enters and which side backspace deletes. “RTL carets move left” is not enough, because left and right have opposite directions on the boundary. The Unicode Bidirectional Algorithm paints; the editor still has to pick a logical index on the seam.

Why it happens

The algorithm splits characters into runs, each with a direction. A logical string Arabic+Latin+Arabic may paint as Arabic on the right, Latin still left-to-right in the middle, Arabic again on the left. Visually the left edge of Latin abuts the right edge of the second Arabic run, but logically Latin sits between them. A caret drawn in that visual seam corresponds to two candidate logical indices (before or after Latin). Common rules: follow the direction of the text about to be typed, follow the paragraph base direction, or show a pair of split carets. The wrong index drops a Latin letter inside an Arabic word. Digits are weakly directional, so phone numbers are especially sensitive.

Studying it

Build short strings with one and several direction switches (a name plus a Latin brand, a URL in an RTL paragraph). Click and arrow-walk every visual seam and record which run the next character enters. Compare split-caret versus single-caret implementations. Ask mixed-script natives to mark where they think insertion will go. Automation can draw a caret at every logical index, snapshot visual coordinates, and find many-to-one mappings.

Where it stops holding

With no embedded opposite-direction text there is no switch. Forced-direction marks (LRO/RLO) create artificial seams; results on those materials do not represent ordinary users. Image-as-text UI has no logical order. Vertical mixed layout uses different switch rules and must not reuse horizontal bidi.

Applying it

  • At a direction seam, use a split caret or clearly highlight which run the next key will enter.
  • When a click lands on the seam, choose the logical index from the language about to be typed, not always from the paragraph base direction.
  • Isolate URLs, code, and phone numbers as embeddings so weakly directional characters do not scramble the boundary.
  • Verify by clicking the left and right edges of an English word in the middle of an RTL sentence and typing a letter; it must enter that word, not the Arabic on either side.

Related

  • Same group: C6.30.1 In right-to-left text, caret motion runs opposite visual advance · C6.30.3 Visual caret location and the logical insertion point may not correspond intuitively in bidirectional text · C6.30.4 Left/right arrow semantics must be remapped to text direction rather than assumed fixed
  • Adjacent: C6.13 Text selection and caret placement · C6.25 IME state and switching
  • Search: bidi boundary · split caret · directional run

Cards in the same group

Quick Actions

Share

Share this page

ios_share

https://hci.top/en/handbook/C6.30.2