Re: [w3c/clipboard-apis] The "focused node" when determining event target needs to be defined (#70)

I agree with what @MatsPalmgren says above, except it should likely be `Selection.anchorNode`, which represents the _start_ of the selection.

I agree that the target should always be `anchorNode`, no matter what the context is, because it makes it much more intuitive to work with this event.

For example you can look at [this widely use implementation of copy](https://github.com/sudodoki/copy-to-clipboard/blob/master/index.js): the focus is never set on the element, this means that we don't control where `copy` event would be sent. Setting the focus on the added element seems to be an extra work that would be otherwise unneeded. Another way would be to make the node editable, which seems also an unneeded work.
Instead the current behavior in Firefox and Chrome is that we send the `copy` event to the selection, [which makes it possible to handle it here](https://github.com/sudodoki/copy-to-clipboard/pull/76/files).

Also because both Chrome and Firefox implement it this way now, and changing it might break existing websites and apps. It would most certainly break ours and the linked change above.

-- 
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/70#issuecomment-479815420

Received on Thursday, 4 April 2019 09:08:01 UTC