[w3c/selection-api] Selection.modify() with left/right and "lineboundary" should use resolved line base direction for unicode-bidi: plaintext (Issue #364)

OmerMor created an issue (w3c/selection-api#364)

When a paragraph uses `unicode-bidi: plaintext` (including the UA
stylesheet default for `<textarea dir="auto">` and `<pre dir="auto">`),
a line's resolved base direction can differ from the enclosing block's
CSS `direction`.

Example:
```html
<div contenteditable dir="rtl">
  <p style="unicode-bidi: plaintext">abc def</p>
</div>
```

In Chromium (https://crbug.com/590772371), `selection.modify("move",
"left", "lineboundary")` (and macOS `Cmd+Left`, plus `"extend"` and the
mirror Hebrew-in-`dir="ltr"` case) uses the enclosing block's CSS
direction (`rtl`) instead of the line's resolved base direction (`ltr`),
moving to offset 7 (visual right end) instead of offset 0 (visual left
end).

Question:
Should `Selection.modify()` with `"left"` / `"right"` and granularity
`"lineboundary"` be specified to use the line's resolved base direction
(matching `unicode-bidi: plaintext`), while keeping normal
`unicode-bidi` behavior unchanged?

Related:
- https://github.com/w3c/selection-api/issues/37
- https://github.com/w3c/selection-api/pull/357
- https://crbug.com/590772371
- Tentative WPT CL in review: https://crrev.com/c/8877244 (`selection/bidi/modify-lineboundary-plaintext.tentative.html`)

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

Message ID: <w3c/selection-api/issues/364@github.com>

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