devtools icon indicating copy to clipboard operation
devtools copied to clipboard

DevTools needs better copy behaviour, important info not selectable, or has no copy button.

Open CoderDake opened this issue 2 years ago • 6 comments

CoderDake avatar Nov 21 '23 14:11 CoderDake

Are there details on what info is not selectable or what info the user would like a copy button for?

kenzieschmoll avatar Nov 21 '23 17:11 kenzieschmoll

For example, in the Network => Overview tab, I can select but not copy the request uri using cmd c. The same is true for all the tabs, nothing is copyable.

leon-adapptor avatar Jun 11 '24 03:06 leon-adapptor

I chatted with @DanTup about this, and it looks like the VSCode bug is still unnadressed, which may cause the copy command not to work: https://github.com/microsoft/vscode/issues/129178

I'll see if I can come up with a quick doc to discuss some workarounds so all platforms can have a way around this.

CoderDake avatar Jun 12 '24 15:06 CoderDake

(If you're hitting this issue, please consider adding 👍 to the VS Code issues https://github.com/microsoft/vscode/issues/129178 and https://github.com/microsoft/vscode/issues/182642)

My latest summary of this issue was posted at https://github.com/flutter/devtools/issues/8190#issuecomment-2296364693 but the TL;DR is that on Mac, the native behaviour of Cmd+C (and others, like Cmd+A) doesn't work inside iframes in VS Code, nor do the key events get passed to us in the iframe.

There's an open issue in the VS Code repo here:

https://github.com/microsoft/vscode/issues/129178

We also can't use the clipboard APIs from within the iframe:

https://github.com/microsoft/vscode/issues/182642

None of the workarounds I've tried have worked, and I've not been able to debug myself in VS Code either (the code in VS Code is quite complex and I'm not very familiar with it). I'd hoped someone on the Code team might have commented by now, but unfortunately not.

Many places in DevTools have a "copy" button which avoids this (because we can ofc handle a click on the button), but that's probably not appropriate everywhere.

For reasons I also don't understand, this issue seems specific to Mac and Cmd+C. Using Ctrl+C on Windows works fine.

(fyi @jwren)

DanTup avatar Apr 02 '25 10:04 DanTup

When embedded in VS code on a mac, can we make Cmd+C send a request to DTD that calls a VS code registered method to put the content in the clipboard? Or could we put the content in the clipboard from DTD or DevTools server directly instead?

kenzieschmoll avatar Apr 02 '25 15:04 kenzieschmoll

I updated my VS Code repro and posted some notes at https://github.com/microsoft/vscode/issues/129178#issuecomment-2775861724

At least part of the issue seems to be that the KeyUp event never fires for the key A/V/C when pressed with Cmd. Eg. if you press Cmd+C we get "keydown cmd, keydown c, keyup cmd" but never "keyup c". I'm not sure, but I would guess that probably this is why the native functionality is not working too.

DevTools could try to infer the copy from the key down events (and use the existing copyToClipboard functionality use by the Copy buttons) but I would be worried about potentially mishandling other keyboard shortcuts (or if the user has re-bound any of these - assuming macOS allows it).

I so also wonder if this new information about the missing keyUp might help track down the VS Code issue.

DanTup avatar Apr 03 '25 14:04 DanTup