[w3c/clipboard-apis] Should clipboard actions consider whether selection has focus? (#57)

Consider a page with

```
<div contenteditable>text</div>
<input type=checkbox>
```

And steps:
1. Copy something into clipboard
2. Select "text"
3. Click the checkbox to move focus. Now we have an unfocused selection on "text"
4a. Press Ctrl+C (or Cmd+C on Mac) to trigger a copy action
4b. Press Ctrl+X (or Cmd+X on Mac) to trigger a cut action
4c. Press Ctrl+V (or Cmd+V on Mac) to trigger a paste action

Should these actions have effects? And what should be the clipboard event targets?

The current spec says nothing about focus, so all actions should be effective and targetting DIV following the spec.

While copying without focus may be reasonable, cut and paste are somehow different because they modify the current document. And it doesn't seem quite desirable to change an unfocused part of document in a user action. [1]

Current behaviors of different browsers (demo at https://jsfiddle.net/54scvon9/4/):

Chrome 62.0.3202.94:
copy: effective, targetted on DIV
cut & paste: ineffective, targetted on DIV [2]

Firefox 57:
All effective and targetted on the text node [3]

Safari 11.0.1(12604.3.5.1.1):
All effective and targetted on DIV

Edge 40.15063.0.0:
All effective and targetted on DIV

[1] Discussed in crbug.com/771604
[2] This seems to be a Chrome bug: crbug.com/755459

-- 
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/clipboard-apis/issues/57

Received on Thursday, 30 November 2017 18:47:51 UTC