Skip to content
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

Cannot paste in search field because webview steals the paste #132641

Closed
alexdima opened this issue Sep 8, 2021 · 5 comments · Fixed by #134164
Closed

Cannot paste in search field because webview steals the paste #132641

alexdima opened this issue Sep 8, 2021 · 5 comments · Fixed by #134164
Assignees
Labels
important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders webview Webview issues
Milestone

Comments

@alexdima
Copy link
Member

alexdima commented Sep 8, 2021

Version: 1.61.0-insider (user setup)
Commit: 34861b8c8aa76b517f203743ad5b5d72ef5fcd81
Date: 2021-09-08T05:17:18.073Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042
  • I was selfhosting, I checkout a PR, then another one, then another one...
  • I then moved away from the PR webview editor to another editor (I don't remember exactly what steps I took)
  • I can no longer paste in e.g. the search viewlet
  • The reason is because the webview handler for Paste takes over.
  • Here is the log output after enabling the trace log level and the keyboard troubleshooting command:
[2021-09-08 13:33:18.400] [renderer6] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: KeyV, keyCode: 86, key: v
[2021-09-08 13:33:18.400] [renderer6] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyV, keyCode: 52 ('V')
[2021-09-08 13:33:18.400] [renderer6] [info] [KeybindingService]: | Resolving ctrl+V
[2021-09-08 13:33:18.400] [renderer6] [info] [KeybindingService]: \ From 4 keybinding entries, matched editor.action.clipboardPasteAction, when: no when condition, source: built-in.
[2021-09-08 13:33:18.400] [renderer6] [trace] KeybindingService#dispatch Ctrl+V editor.action.clipboardPasteAction
[2021-09-08 13:33:18.400] [renderer6] [trace] CommandService#executeCommand editor.action.clipboardPasteAction
[2021-09-08 13:33:18.401] [renderer6] [trace] Executing Command 'editor.action.clipboardPasteAction' which has 6 bound.
[2021-09-08 13:33:18.401] [renderer6] [trace] Command 'editor.action.clipboardPasteAction' was handled by 'webview'.
[2021-09-08 13:33:18.631] [renderer6] [info] [KeybindingService]: + Storing single modifier for possible chord ctrl.
[2021-09-08 13:33:18.934] [renderer6] [info] [KeybindingService]: + Clearing single modifier due to 300ms elapsed.

TO_UPLOAD

The handler comes from here. It looks like there IWebviewService.activeWebview.isFocused evaluates to true even when the focus is somewhere else on the page.

Note: After clicking on the webview editor tab and back in the search viewlet, paste works again, so presumably IWebviewService.activeWebview.isFocused now returns false again correctly.

Giving this important as we constantly have people complaining about Paste not working and it is just a huge burden on me to always get these issues. If IWebviewService.activeWebview.isFocused cannot be trusted, the command implementation that you register could just look at the activeElement and make a decision based on that.

@alexdima alexdima added the important Issue identified as high-priority label Sep 8, 2021
@IllusionMH
Copy link
Contributor

It was already reported in #127881 and fixed.
Can't reproduce in latest Insiders.

Probably PR is not up to date with main?

@alexdima
Copy link
Member Author

alexdima commented Sep 8, 2021

@IllusionMH Thanks for trying to reproduce, although I could not find any clear steps. I am on latest Insiders from 9hrs ago.

@TylerLeonhardt
Copy link
Member

@alexdima duplicate of #132641 ?

@alexdima
Copy link
Member Author

@TylerLeonhardt I have really tried to, but I do not understand the issue #110528 . From my latest understanding it seemed that pasting works, but Enter does not work for them. In any case, I could never reproduce anything.

My understanding comes from #110528 (comment) :

The problem is not in pasting some text in some filed, but in entering it as in input. With pressing ENTER key which is not applicable to markdown.

@rebornix
Copy link
Member

rebornix commented Oct 1, 2021

Ran into this when following Live Preview's readme #134292

mjbvz pushed a commit that referenced this issue Oct 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders webview Webview issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@rebornix @IllusionMH @TylerLeonhardt @alexdima @mjbvz and others