Re: [selection-api] caret-based selection movement (#27)

I think the behavior should be both consistent across browsers and "reasonable" in the sense that it would correspond to a normal setup for an editor. If one of those two conditions is not given, all editors will constantly have to check where the caret is in relation to its surroundings before executing a character insertion.

As for why links are treated differently: Possibly because the makers of browsers thought it easier to exit ```<i>``` elements than ```<a>``` elements with most editor UIs?

Take the below test. In Chrome the behavior at the end of the three lines is:

1. ```<i>``` outside-inside. However, the user can exit the ```<i>``` by hitting CTRL+I.

2. ```<a>``` outside-outside. 

3. ```<span class="custom">``` outside-inside.

In Firefox the behavior is however;

1. ```<i>``` outside-inside.

2. ```<a>``` outside-inside. 

3. ```<span class="custom">``` outside-inside.


Source:

```
<html>
<head>
    <style>
        .custom {
            color: green;
        }
    </style>
</head>
<body>
<div contenteditable=true>
<p>Hello <i>Austria</i></p>

<p>Hello <a href="http://www.austria.at">Austria</a></p>

<p>Hello <span class="custom" data-custom="something important">Austria</span></p>
</div>
</body>
</html>

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/27#issuecomment-65760296

Received on Friday, 5 December 2014 08:28:57 UTC