This is definitely a wise UX way, using user behavior.
It’s an answer to a question
on StackOverflow from Daniel LeCheminant.
We don’t actually “access the user’s clipboard”, instead we help the user out a bit by selecting something useful when they press Ctrl+C.
Sounds like you’ve figured it out; we take advantage of the fact that when you want to hit Ctrl+C,
you have to hit the Ctrl key first. When the Ctrl key is pressed,
we pop in a textarea that contains the text we want to end up on the clipboard,
and select all the text in it, so the selection is all set when the C key is hit.
(Then we hide the textarea when the Ctrl key comes up)
Specifically, Trello does this:
… and the CSS makes it so you can’t actually see the textarea when it pops in … but it’s “visible” enough to copy from.
When you hover over a card, it calls
… so then the clipboard helper knows what to select when the Ctrl key is pressed.