Microsoft/vscode

Unable to use shortcuts like Cmd+A, Cmd+C, Cmd+V inside an iframe inside a webview on macOS

Open

#129 178 ouverte le 22 juil. 2021

Voir sur GitHub
 (21 commentaires) (117 réactions) (1 assigné)TypeScript (10 221 forks)batch import
bughelp wantedwebview

Métriques du dépôt

Stars
 (74 848 stars)
Métriques de merge PR
 (Merge moyen 11h 43m) (1 000 PRs mergées en 30 j)

Description

Edit: This is unrelated to clipboard operations, because Cmd+A doesn't work either.

I created a simple repro here that opens an iframe inside a webview:

https://github.com/DanTup/vs-code-webview-copy-paste

The webview contains a text input. You cannot copy, paste, or even Select All inside that text input.

(Original post below)


I'm embedding an app inside a webview using an iframe (avoiding the iframe is not likely feasible). In order to have VS Code keyboard shortcuts still work, keypresses are passed over using the code here:

This works for many keypress (for example opening the command palette), however it's not possible to use Cmd+C to copy to the clipboard. Edit -> Copy works as expected.

It's not clear if there needs to be some extra handling in the webiew or iframe to make this work, or if it needs support from VS Code.

Guide contributeur