[w3c/editing] Specify basic bidirectional caret navigation invariants (avoid traps, loops, and non-editable entry) (Issue #553)

OmerMor created an issue (w3c/editing#553)

Keyboard arrow-key movement in mixed LTR/RTL content is not fully
specified across engines, and visual-order vs. logical-order behavior
intentionally differs (see https://github.com/w3c/selection-api/pull/357).
However, users hit clear caret traps in current engines regardless of
whether they expect visual or logical order:

- Bouncing between two lines when pressing one arrow key repeatedly
  across blank, digit-only, or opposite-script `unicode-bidi: plaintext`
  paragraphs (observed in Chrome and Firefox; in Safari 26.6.2, blank
  `<textarea>`, digit-only, and opposite-script paragraphs cross cleanly,
  and only an empty plaintext `<p><br></p>` bounces).
- Entering inline `contenteditable="false"` spans (Chrome with the
  default-off `BidiVisualOrderCaretMovement` flag,
  https://crbug.com/499819853) or getting stuck before them inside an
  embedded opposite-direction run (Safari 26.6.2,
  https://bugs.webkit.org/show_bug.cgi?id=333411; not reproduced in
  Safari 27.3 beta).
- Failing to move/shrink backward across `\n` in `<textarea>` on
  Ctrl+Left / Ctrl+Shift+Left (Chrome, https://crbug.com/490801763,
  also affects plain LTR text).
- Hanging WebDriver actions on ArrowLeft at the start of an RTL line in
  an LTR plaintext `<textarea>` (Safari 26.6.2,
  https://bugs.webkit.org/show_bug.cgi?id=333410; not reproduced in
  Safari 27.3 beta).

Proposal / question for the Editing WG:
Should we document a minimal set of order-agnostic invariants for
horizontal arrow-key navigation (and matching tentative WPTs)?

- Caret and selection anchor stay inside the editing host and never
  enter `contenteditable="false"` from editable content.
- Repeated presses of one horizontal arrow key make progress to the far
  edge without stopping early, skipping intermediate paragraphs/runs, or
  looping (allowing a DOM boundary offset to be visited twice in visual
  engines, once per affinity). Across `unicode-bidi: plaintext`
  paragraphs with different resolved directions, this explicitly rules
  out per-paragraph logical arrow mapping when it oscillates.
- Left and Right from a collapsed caret do not move to the same DOM
  position, and pressing one arrow then the opposite returns to start.
- Shift+Arrow keeps the anchor fixed and shrinks back to collapsed when
  reversed (compatible with both visual Shift+Arrow and Firefox's
  default logical Shift+Arrow).

Tentative WPT CL in review: https://crrev.com/c/8877244

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/553
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/553@github.com>

Received on Sunday, 29 November 2026 23:23:10 UTC