Re: [editing-explainer] What browser internals can be exposed to help us move the caret in (and against) the block direction? (#56)

I second that implementing UP/DOWN caret navigation in JS is quite complex. I also agree with @kojiishi that specifying the UA hidden selection-associated state is not a good idea.

Maybe, we can use the `beforeselectionchange` event and add a `setResultRange` method to it that can be used to change the selection. This method would know the user intention, so it would be able to preserve whatever hidden selection-related state the UA uses.

```
document.addEventListener('beforeselectionchange', function(e){
    var sel = e.targetRange;
    var resultSel = ...;
    e.setResultRange(resultSel);
});
```

This would be similar to the Clipboard Events, where you can use the `clipboardData` event property to specify the actual data to be copied.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing-explainer/issues/56#issuecomment-106321057

Received on Thursday, 28 May 2015 13:57:01 UTC