Repository navigation
Closed
Labels
bugIssue identified by VS Code Team member as probable bugcandidateIssue identified as probable candidate for fixing in the next releaseelectronIssues and items related to Electronhelp wantedIssues identified as good community contribution opportunitiesupstream-issue-fixedThe underlying upstream issue has been fixedverifiedVerification succeededwebviewWebview issues
Milestone
Description
- VSCode Version: Version: 1.37.0-insider
Commit: d50852d
Date: 2019-07-08T05:33:31.335Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 17.7.0 - OS Version: macOS High Sierra 10.13.6 (17G7024)
Steps to Reproduce:
- Execute the following sample code of extension.
- Execute the
Hello Worldcommand. - Click the tab of WebView and press the
fkey of the keyboard. - In the conlose, only the
window focused!message shown. - Click the tab of WebView, again. Then, press
f. - The message
keyboard F typed!shown.
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
const rootUrl = vscode.Uri.file(context.extensionPath)
const disposable = vscode.commands.registerCommand('extension.helloWorld', async (args, brgs, crgs) => {
if (!vscode.window.activeTextEditor) {
return;
}
const panel = vscode.window.createWebviewPanel(
'catCoding',
'Cat Coding',
{ preserveFocus: true, viewColumn: vscode.ViewColumn.Beside },
{ enableScripts: true }
);
panel.webview.html = getHtml();
});
context.subscriptions.push(disposable);
}
function getHtml() {
return `
<!DOCTYPE html><html><head></head>
<body>
<script>
window.onfocus = function() {
console.log('window focused!');
}
window.addEventListener('keydown', function(evt) {
if(evt.keyCode == 70 && evt.target.nodeName != 'INPUT') {
console.log('keyboard F typed!')
}
})
</script>
`
}
// this method is called when your extension is deactivated
export function deactivate() {}Does this issue occur when all extensions are disabled?: Yes
Reacted by Ivan Kravets, Justin Rose, Anna Spysz, Chase Douglas, Timothy, Jan Pilzer, Igor Krupenja, Jerome Lelong and ole
Metadata
Metadata
Labels
bugIssue identified by VS Code Team member as probable bugcandidateIssue identified as probable candidate for fixing in the next releaseelectronIssues and items related to Electronhelp wantedIssues identified as good community contribution opportunitiesupstream-issue-fixedThe underlying upstream issue has been fixedverifiedVerification succeededwebviewWebview issues

Activity
Hirse commentedon Jul 9, 2019
I am having the same issue with the Ungit extension.
justinarose commentedon Aug 13, 2019
Any updates on this? If it's any help, I don't experience this bug on my Ubuntu machine, but it does occur on my Mac, so could be something specific to that build.
pfeerick commentedon Aug 13, 2019
That makes it an even more interesting bug/gremlin, as I can reproduce it on Manjaro Linux, KUbuntu 18.04, Ubuntu 18.04 and Windows 10. If you running a Ubuntu build and it's not affecting you, that may make it even harder to track down.
Just to be clear, if you open whatever WebViewPanel based extension you're using (you don't say which), click on some onscreen element of VSCode - editor window, menubar, activity sidebar, etc, and then click back on the WebViewPanel and try to enter text, it does get captured in the WebViewPanel for you? The key aspect here is input focus - if you click on some element of VSCode, and back on the WebViewPanel, it doesn't regain input focus - it stays with whatever you clicked on previously.
justinarose commentedon Aug 14, 2019
So I'm getting this bug with LaTeX-Workshop: James-Yu/LaTeX-Workshop#1481. When switching to view the pdf on a Mac via command+2, all shortcuts within VSCode seem to no longer work. What makes this even nastier is that it sometimes only happens after switching TWICE (i.e. I can go from pdf to tex to pdf via command+1 and command+2 but it eventually gets stuck focused on the pdf). I believe this focus issue is the underlying problem with the bug, as referenced earlier. Strangely, I don't experience this on Ubuntu at all.
ivankravets commentedon Aug 15, 2019
Matt Bierner (@mjbvz) do you have any updates here? We over million installs of our PlatformIO IDE extension and this issue blocks platformio/platformio-vscode-ide#892
mjbvz commentedon Aug 15, 2019
PRs welcome. The webview code lives here:
vscode/src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
Line 266 in 0270232
Reload each time the local editor becomes visible
txase commentedon Aug 27, 2019
I've narrowed it down to changes introduced between the June 2nd and June 5th VS Code Insiders builds. A couple unfortunate details have made this hard to track down further:
It's likely the root cause is either in the proprietary additions or in some build process or environment change between those two dates, but I can't access either to try to fix the issue
6/2 Insiders build (good) commit: a848f18
6/5 Insiders build (bad) commit: fc294b6
mjbvz commentedon Aug 28, 2019
Chase Douglas (@txase) Thanks for the investigation.
We upgraded from electron 3 to electron 4 between those two commits which seems suspect. When building from master, did you do a full build (including yarn install) at those checkpoints?
Also, if this is electron related, can you try our our electron 6 exploration builds to see if that fixes the problem.
txase commentedon Aug 28, 2019
Matt Bierner (@mjbvz) Here's the steps I took:
I also tried running
yarn run gulp vscode-darwinandyarn run gulp vscode-darwin-minto see if the app packages they produced exhibit the bug. Unfortunately, they don't.I also tried the electron 6 exploration build you linked. It also has the bug.
One thing that would be interesting to try: Are you able to re-build the 6/2 commit of the insiders edition? If it had the bug after being rebuilt, then it would point to a change in the build pipeline having caused the issue. If it doesn't have the bug, then it is a problem in the source code somewhere (OSS or proprietary).
txase commentedon Aug 28, 2019
Matt Bierner (@mjbvz) If it helps, here's a reproducible set of steps to see the issue using our extension:
template.yamlwith the following inside:It's possible to fix the focus state by double clicking on the canvas editor tab.
Here's a video showing the above:
29 remaining items
txase commentedon Nov 15, 2019
I've made some progress on this issue, though it's unclear still exactly why this is occurring only in VSCode vs in Chrome. I sent an email to two Chromium maintainers who work on the relevant bits hoping to get their take. For those curious, here's what I sent them:
txase commentedon Nov 19, 2019
Chromium issue filed here: https://bugs.chromium.org/p/chromium/issues/detail?id=1026056
txase commentedon Nov 20, 2019
The fix for Chromium has been merged to master: chromium/chromium@c4f0a72 🎉. It will be released in Chromium M80.
Robo (@deepak1556) Matt Bierner (@mjbvz) Benjamin Pasero (@bpasero) Is it possible for you to apply this patch to the Electron sources when you build for the next release? 🙏
deepak1556 commentedon Nov 20, 2019
Chase Douglas (@txase) electron/electron#21219 , thanks for following up on this on chromium end.
deepak1556 commentedon Nov 21, 2019
Fixed with #85266
deepak1556 commentedon Nov 21, 2019
Chase Douglas (@txase) the fix is now available in latest insiders
txase commentedon Nov 21, 2019
I already checked earlier today. Works beautifully! 🙏