-
Notifications
You must be signed in to change notification settings - Fork 364
Handle shortcuts for actions like copy/paste when embedded inside VS Code #9472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DanTup
commented
Oct 16, 2025
...tools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart
Show resolved
Hide resolved
This was referenced Oct 16, 2025
elliette
reviewed
Oct 16, 2025
...tools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart
Outdated
Show resolved
Hide resolved
elliette
approved these changes
Oct 16, 2025
Member
elliette
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question but LGTM!
I'm going to file a bug for the flaky integration tests (re-running them now).
srawlins
pushed a commit
that referenced
this pull request
Oct 28, 2025
…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 Dart-Code/Dart-Code#3488 Fixes #7253 Fixes #9435 See #8190 (I don't know if we still want to do other work here) See microsoft/vscode#129178 (comment) cc @elliette
copybara-service bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Oct 28, 2025
Cherry-picked commits in DevTools repo include: * flutter/devtools@1b39a2e "Add basic support for Flutter web applications served with -d web-server" flutter/devtools#9468 * flutter/devtools@fb4fa1f "Handle shortcuts for actions like copy/paste when embedded inside VS Code" flutter/devtools#9472 * flutter/devtools@cd14e27 "Fix position and width of "error count" badge in Network in app bar" flutter/devtools#9470 * flutter/devtools@6b9ba48 "Add a horizontal scrollbar to DevTools tables" flutter/devtools#9482 * flutter/devtools@1f8b3f5 "Disable screens not compatible with DWDS websocket mode" flutter/devtools#9481 * flutter/devtools@8a42447 "Table columns are resizable" flutter/devtools#9485 * flutter/devtools@5c0b17a "Network panel: disable Header ExpansionTiles when no data" flutter/devtools#9492 * flutter/devtools@0dbead1 "Network: add a banner indicating when we are not logging network requests" flutter/devtools#9495 Issue description: Users were unable to use various functions in the DevTools Network screen, including copy+paste, view requests, and view the request table when embedded in a small window. What is the fix: Various fixes are included for these user issues. Why cherry-pick: Users reported these issues in the user survey pre-dating Flutter 3.35; it is important for user trust to fix these in Flutter 3.38. Risk: Low, this fix only affects DevTools. Issue link(s): Dart-Code/Dart-Code#3488, flutter/devtools#7253, flutter/devtools#9435, flutter/devtools#8920, flutter/devtools#9465, flutter/devtools#9488, flutter/devtools#9464 Cherry-pick: flutter/devtools@v2.51.0...2.51.1 Change-Id: Iae696151778849fdb6faf6bf83a123f518fee77c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458020 Reviewed-by: Devon Carew <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Elliott Brooks <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.customDevToolsand in both of them, I can copy/paste/select-all/undo.Fixes Dart-Code/Dart-Code#3488
Fixes #7253
Fixes #9435
See #8190 (I don't know if we still want to do other work here)
See microsoft/vscode#129178 (comment)
cc @elliette