vscode: Closing Extension window quickly causes whole VSCode.dev PWA to close
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: vscode.dev 1.74.2
- OS Version: Windows 10
Steps to Reproduce:
This happens when vscode.dev is installed as a PWA
- Click on any extension to open tab1
- Press Ctrl + N to open another tab2 (Untitled-2)
- Press Ctrl + W, tab2 will close and switch to tab1
- IMPORTANT: Very quickly, press Ctrl + W again
- Expect only tab1 to close, but whole vscode closes
See video https://user-images.githubusercontent.com/946010/211139627-91896b53-cb7d-4a43-8c63-a30e29d0695c.mp4
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (8 by maintainers)
Commits related to this issue
- Try to capture key presses more aggressively in loading For #170750 — committed to mjbvz/vscode by mjbvz a year ago
- Try to capture key presses more aggressively in loading webviews (#176326) Try to capture key presses more aggressively in loading For #170750 — committed to microsoft/vscode by mjbvz a year ago
@sandy081 We have logic that should prevent this: https://github.com/microsoft/vscode/blob/c600c105793d31942279de2ad95dbbb61c29715f/src/vs/workbench/contrib/webview/browser/pre/index.html#L587
What I think happens here though is that ctrl+w is pressed before our event handlers has been hooked up. This is likely because the webview content we control has not yet been loaded. I’ll see if we can intercept keyboard shortcuts for that case too but am not sure we will be able to
I’ve ensured there we intercept keypresses as much as possible. However I believe there’s still a cases where the webview’s iframe itself is loading and focused, but scripts in it have not yet been evaluated in it where ctrl+w gets through
I explored using the lifecycle service to handle that case but this has the downside of triggering extra “Are you sure you want to close” prompts when closing webview that are still loading
Given that this is now more difficult to hit and give that fully fixing it fully would have other consequences, I’m going to close this issue
It is still weird though that this seems to be related to the extensions editor having loaded or not so maybe extension editor folks could have a look.
For me,
Cmd+W
only closes the entire PWA application if the markdown within the extension editor has not yet loaded. Printing thedocument.activeElement
I see that sometimes abody
element has focus and sometimes aniframe
. Since it seems to sometimes prevent closing the app, I wonder if the code we use here is not fully applied everywhere.