Re: [w3c/selection-api] Expose with which bidi-level caret is affiliated as well as API to set it (#57)

I support this idea.
Can we unify this to `beforeLineWrap`#32?

In Blink/WebKit, there is TextAffinity = {Downstream, Upstream}. Upstream means `beforeLineWrap`.

When I work on LTR in RTL case, I found TextAffinity helps explaining caret position.

For example:
``<div dir=rtl style="padding: 50px">abcdef</div>``

When clicking left edge, each browser sets selection as caret to:
- Chrome: abcdef@6 `|abcdef`
- Edge: abcdef@0  `|abcdef`
- Firefox: abcdef@0  `|abcdef`

All UAs display caret before `a`, like `|abcdef`, where `|` denotes caret.
Note: This is as same as `collapse("abcdef", 0)`  except for Chrome.

When typing "X", after clicking left edge:
- Chrome: abcdefX@7 |abcdefX
- Edge: Xabcdef@1 X|abcdef
- Firefox: Xabcdef@1 X|abcdef

If we have TextAffinity, Chrome can use `abcdefX@7`/Upstream, to place caret after `X`, e.g. `abcdefX|`,
and left edge clicking as `abcdef@0`/Downstream as Edge/Firefox.

For `collapse("abcdef", 0)`, `collapse("abcdef", 6)`
- Chrome `abcdef|` `|abcdef`
- Edge: `|abcdef` `abcdef|`
- Firefox: `|abcdef` `abcdef|`

Other examples found in https://goo.gl/A5yhvl

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

Received on Thursday, 13 April 2017 08:50:46 UTC