| commit | 03f36f51b74fc00797d03d2003e50e4652eff18c | [log] [tgz] |
|---|---|---|
| author | Danny Tuppeny <danny@tuppeny.com> | Fri Oct 17 10:14:08 2025 +0100 |
| committer | Sam Rawlins <srawlins@google.com> | Mon Oct 27 18:19:24 2025 -0700 |
| tree | 2952c26181669b1266427724fcd3e9cd692d3294 | |
| parent | 606e1d7f2fd2ce56837c1674a0a388c8e90b1cbf [diff] |
Handle shortcuts for actions like copy/paste when embedded inside VS Code (#9472) On macOS, short-cut keys like Cmd+C, Cmd+V don't work in embedded iframes. This happens because VS Code calls `setIgnoreMenuShortcuts(true)` and disables the OS/browser functionality for these actions. For the top-level webviews, it handles keypresses, passes them up to VS Code, and VS Code then passes back down commands for copy/paste/etc. However for our nested iframes, this keypress handling (and command passing) does not occur. I wasn't able to find any way to fix this inside VS Code (it can't reach into our iframes because they're a different origin) but I found that we can simulate what it's doing itself. I thought I'd tried this in the past and determined this wouldn't work, however it seems to work fine today (maybe I was trying to handle the Copy/Paste events rather than the keys? 🤔) I can't write automated tests for this because we need to verify the actual behaviour of pressing keys, but I've tested on both my Mac and Windows (it already worked on Windows and doesn't need this, but I've left this code to run for all platforms in case there is a difference between using VS Code's native menus vs not) by using `dart.customDevTools` and in both of them, I can copy/paste/select-all/undo. Fixes https://github.com/Dart-Code/Dart-Code/issues/3488 Fixes https://github.com/flutter/devtools/issues/7253 Fixes https://github.com/flutter/devtools/issues/9435 See https://github.com/flutter/devtools/issues/8190 (I don't know if we still want to do other work here) See https://github.com/microsoft/vscode/issues/129178#issuecomment-3410886795 cc @elliette
Dart & Flutter DevTools is a suite of performance tools for Dart and Flutter.
For documentation on installing and trying out DevTools, please see our docs.
Contributions welcome! See our contributing page for an overview of how to build and contribute to the project.
By using Dart DevTools, you agree to the Google Terms of Service. To understand how we use data collected from this service, see the Google Privacy Policy.