devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Keyboard shortcuts while focused on DevTools extensions in VS Code

Open elliette opened this issue 9 months ago • 7 comments

Steps to reproduce:

  1. Open a DevTools extension in VS Code
  2. While focused on the extension panel, try to open the command palette (cmd+shift+P)

Expected behavior: can open command palette Actual behavior: cannot open command palette

FYI @kenzieschmoll @DanTup

elliette avatar Apr 04 '25 16:04 elliette

Is this a DevTools extensions only issue? I feel like I've seen this with other panels too.

kenzieschmoll avatar Apr 04 '25 17:04 kenzieschmoll

We have some code (partly in DevTools and partly in Dart-Code) that is supposed to help with this:

https://github.com/flutter/devtools/blob/bb11f19004f1c481467a6ad82e21d62d812d171a/packages/devtools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart#L80-L84

https://github.com/Dart-Code/Dart-Code/blob/027f4feedb60816166862fcb0d02295ccfe841ea/src/extension/sdk/dev_tools/embedded_view.ts#L54

@elliette can you confirm where you see this (which DevTools page and/or which kind of embedding in VS Code - sidebar vs editor)?

DanTup avatar Apr 04 '25 17:04 DanTup

I was seeing this in editor (not sidebar) and only for extension pages (provider, package:foo, etc). The "regular" DevTools panels in the editor did not behave this way.

elliette avatar Apr 04 '25 18:04 elliette

I wonder if you'd see it when the performance page > timeline events sub tab is open also. My suspicion is that this may be when an iFrame has focus.

kenzieschmoll avatar Apr 04 '25 18:04 kenzieschmoll

My suspicion is that this may be when an iFrame has focus.

Ah, this would make sense - because those iframes aren't passing the keystrokes up like the normal DevTools pages are (in the quoted code above). I think to fix this, we'd need those inner iframes to pass keystrokes up, and then DevTools to handle them and pass them upwards again. It's pretty hacky 😞

DanTup avatar Apr 04 '25 19:04 DanTup

This could be affected by @DanTup 's https://github.com/flutter/devtools/pull/9472. But probably not entirely, as per Danny's comment just above.

srawlins avatar Oct 22 '25 21:10 srawlins

I don't think that helps with this - that was specifically to handle Copy/Paste (although as I write this I realise that the extension frames are going to have this bug too).

I think the only fix for this is for the extensions that are iframed in to perform similar code to the two lots of code linked above (the new copy/paste handling code to support copy/paste, but also something to postMessage other keystrokes upwards to DevTools - which will need to listen to those messages and then forward them on upwards again as it does with its own captured keystrokes).

If DevTools extensions are already pulling in some DevTools code, then perhaps this could be done automatically for them so they don't need to do it themselves.

DanTup avatar Oct 22 '25 21:10 DanTup