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

I agree it seems we want to give users the ability to insert text immediately on either side of anything that is in their content but they can't edit. 

What if we specified the general rule that any visible but non-editable part of the document should be treated in its entirety as a single character as far as caret movement is concerned?

A visible but non-editable part of the document could be: an SVG, IMAGE, VIDEO, whatever. Also, it implies the visible characters (and any other dom element) inside a cE=false.

Given your first example the result would be this:
```
<div contenteditable=true>Hello <span contenteditable=false>Aus<span contenteditable=true>|tr</span>ia</span>!</div>
```

Also, by defining behavior in terms of "visible content" we handle some odd edge cases in a manner that I think is best for the user: 
- invisible elements (display:none) are "transparent" to the caret
- cE=false elements or SVGs that are actually empty are also "transparent" to the caret. 

Do you think these make sense as default behaviors? 


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

Received on Saturday, 6 December 2014 23:44:25 UTC