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

>  Browser doesn't really takes away the focus when clicking on the checkbox in your example. 

Focus _is_ moved to the checkbox according to document.activeElement... but the (now unfocused) selection can still be copied with CTRL+C. 

> And at least for Chrome, focused and unfocused selection have different appearance. In Chrome, a focused element has a light blue border. Hence, the user can tell whether selection is focused by checking if the selection is inside the light blue border or not.

Ah yes! True that. I didn't think about that "focus-box". I just saw the blue selection. The selection is unfocused but can still be copied with CTRL+C so it makes sense that is it blue even tough it is outside of the focus-box. In this case, what should be the copy ClipboardEvent's target? Answer: the selected element (not document.body). All browsers do this already.

If we say,
> "...element that is in focus and contains the start of the visible selection in document order"

In the checkbox-case, the selection is _not_ in focus (if you ask document.activeElement) => The copy event would target document.body and not the selected element (wrong). That's why I think it's better if we use the word "visible". The word "focus" can be a little bit ambiguous in this context?

-- 
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#issuecomment-348956870

Received on Monday, 4 December 2017 13:06:40 UTC